Skip to content

Commit

Permalink
Make update for changes to dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-s-ccs committed Mar 12, 2024
1 parent 5895fac commit 361c3ef
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
3 changes: 2 additions & 1 deletion spec/services/cognito/common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
let(:result) { described_class.build_secret_hash('[email protected]') }

before do
stub_const('ENV', { 'COGNITO_CLIENT_SECRET' => cognito_client_secret, 'COGNITO_CLIENT_ID' => cognito_client_id })
ENV['COGNITO_CLIENT_SECRET'] = cognito_client_secret
ENV['COGNITO_CLIENT_ID'] = cognito_client_id
end

it 'creates the same secret hash every time' do
Expand Down
4 changes: 3 additions & 1 deletion spec/services/cognito/confirm_password_reset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@
let(:attribute_type) { double }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
allow(client).to receive(:admin_get_user).and_return(cognito_user)
allow(cognito_user).to receive(:user_attributes).and_return([attribute_type])
Expand Down
4 changes: 3 additions & 1 deletion spec/services/cognito/confirm_sign_up_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
let(:client) { instance_double(Aws::CognitoIdentityProvider::Client) }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
end

Expand Down
5 changes: 4 additions & 1 deletion spec/services/cognito/create_user_from_cognito_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
let(:client) { instance_double(Aws::CognitoIdentityProvider::Client) }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2', 'COGNITO_USER_POOL_ID' => 'myuserpool' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
ENV['COGNITO_USER_POOL_ID'] = 'myuserpool'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
end

Expand Down
4 changes: 3 additions & 1 deletion spec/services/cognito/forgot_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
let(:client) { instance_double(Aws::CognitoIdentityProvider::Client) }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
end

Expand Down
4 changes: 3 additions & 1 deletion spec/services/cognito/resend_confirmation_code_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
let(:client) { instance_double(Aws::CognitoIdentityProvider::Client) }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
end

Expand Down
6 changes: 4 additions & 2 deletions spec/services/cognito/sign_in_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
let(:password) { 'password123!' }
let(:redirect_uri) { 'https://test.com' }

before { stub_const('ENV', { 'CALLBACK_URLS' => '[https://test.com]' }) }
before { ENV['CALLBACK_URLS'] = '[https://test.com]' }

describe '.valid?' do
context 'when both email and password are present' do
Expand Down Expand Up @@ -94,7 +94,9 @@
let(:client) { instance_double(Aws::CognitoIdentityProvider::Client) }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2', 'CALLBACK_URLS' => '[https://test.com]' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
end

Expand Down
4 changes: 3 additions & 1 deletion spec/services/cognito/sign_up_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@
let(:client) { instance_double(Aws::CognitoIdentityProvider::Client) }

before do
stub_const('ENV', { 'COGNITO_AWS_REGION' => 'supersecretregion', 'COGNITO_CLIENT_SECRET' => 'supersecretkey1', 'COGNITO_CLIENT_ID' => 'supersecretkey2' })
ENV['COGNITO_AWS_REGION'] = 'supersecretregion'
ENV['COGNITO_CLIENT_SECRET'] = 'supersecretkey1'
ENV['COGNITO_CLIENT_ID'] = 'supersecretkey2'
allow(Aws::CognitoIdentityProvider::Client).to receive(:new).with(region: 'supersecretregion').and_return(client)
end

Expand Down

0 comments on commit 361c3ef

Please sign in to comment.