Skip to content

Commit

Permalink
Update CI envs
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdavidhamilton committed Nov 10, 2023
1 parent abf9063 commit d95d246
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
DOMAIN: recovery.app
BOT_TOKEN: bot_token
GOV_ONE_BASE_URI: https://oidc.test.account.gov.uk
GOV_ONE_REDIRECT_URI: https://recovery.app/users/auth/openid_connect/callback
GOV_ONE_LOGOUT_REDIRECT_URI: https://recovery.app/users/sign_out

services:
postgres:
Expand Down
14 changes: 6 additions & 8 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ def self.dashboard_headers
# @param gov_one_id [String]
# @return [User]
def self.find_or_create_from_gov_one(email:, gov_one_id:)
existing_user = find_by(email: email) || find_by(gov_one_id: gov_one_id)

if existing_user
existing_user.update!(email: email)
existing_user.update!(gov_one_id: gov_one_id) if existing_user.gov_one_id.nil?
if (user = find_by(email: email) || find_by(gov_one_id: gov_one_id))
user.update!(email: email)
user.update!(gov_one_id: gov_one_id) if user.gov_one_id.nil?
else
existing_user = new(email: email, gov_one_id: gov_one_id, confirmed_at: Time.zone.now)
existing_user.save!(validate: false)
user = new(email: email, gov_one_id: gov_one_id, confirmed_at: Time.zone.now)
user.save!(validate: false)
end
existing_user
user
end

# Include default devise modules. Others available are:
Expand Down
1 change: 0 additions & 1 deletion spec/helpers/gov_one_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'rails_helper'

describe 'GovOneHelper', type: :helper do

describe '#login_uri' do
subject(:login_uri) { helper.login_uri }

Expand Down

0 comments on commit d95d246

Please sign in to comment.