-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [hotfix][Webapp] Bump rails to 5.2.5 [DAH-751] * add new framework defaults * fix rspec tests * update new framework defaults comment
- Loading branch information
1 parent
e0507c0
commit 97041d1
Showing
5 changed files
with
124 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Be sure to restart your server when you modify this file. | ||
# | ||
# This file contains migration options to ease your Rails 5.2 upgrade. | ||
# | ||
# Read the Guide for Upgrading Ruby on Rails for more info on each option. | ||
|
||
# Make Active Record use stable #cache_key alongside new #cache_version method. | ||
# This is needed for recyclable cache keys. | ||
Rails.application.config.active_record.cache_versioning = true | ||
|
||
# Use AES-256-GCM authenticated encryption for encrypted cookies. | ||
# Also, embed cookie expiry in signed or encrypted cookies for increased security. | ||
# | ||
# This option is not backwards compatible with earlier Rails versions. | ||
# It's best enabled when your entire app is migrated and stable on 5.2. | ||
# | ||
# Existing cookies will be converted on read then written with the new scheme. | ||
# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true | ||
|
||
# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages | ||
# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. | ||
Rails.application.config.active_support.use_authenticated_message_encryption = true | ||
|
||
# Add default protection from forgery to ActionController::Base instead of in | ||
# ApplicationController. | ||
Rails.application.config.action_controller.default_protect_from_forgery = true | ||
|
||
# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and | ||
# 'f' after migrating old data. | ||
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true | ||
|
||
# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. | ||
Rails.application.config.active_support.use_sha1_digests = true | ||
|
||
# Make `form_with` generate id attributes for any generated HTML tags. | ||
Rails.application.config.action_view.form_with_generates_ids = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,14 @@ | |
} | ||
end | ||
|
||
let!(:user) do | ||
@user ||= User.create( | ||
email: '[email protected]', | ||
password: 'somepassword', | ||
password_confirmation: 'somepassword', | ||
) | ||
end | ||
|
||
before(:each) do | ||
@request.env['devise.mapping'] = Devise.mappings[:user] | ||
end | ||
|
@@ -47,34 +55,40 @@ | |
end | ||
|
||
describe '#update' do | ||
# We no longer override the update method, but we want to confirm that email | ||
# change confirmation emails are being sent. | ||
let(:user_update_params) do | ||
{ | ||
user: { | ||
id: 1, | ||
email: '[email protected]', | ||
email: '[email protected]', | ||
}, | ||
} | ||
end | ||
|
||
it 'sends a reconfirmation email when email address is updated' do | ||
allow(Force::AccountService) | ||
.to receive(:create_or_update) | ||
.and_return(salesforce_response) | ||
before(:each) do | ||
user.update(allow_password_change: true) | ||
|
||
# Mocking for token authentication | ||
allow(controller).to receive(:update_auth_header).and_return(true) | ||
allow(controller).to receive(:set_user_by_token).and_return(user) | ||
allow(controller).to receive(:set_request_start).and_return(true) | ||
controller.instance_variable_set(:@resource, user) | ||
end | ||
|
||
# We no longer override the update method, but we want to confirm that email | ||
# change confirmation emails are being sent. | ||
it 'sends a reconfirmation email when email address is updated' do | ||
message_delivery = instance_double(ActionMailer::MessageDelivery) | ||
# Expect 2 emails, once for original confirmation, and once for email change. | ||
expect(Emailer) | ||
.to receive(:confirmation_instructions) | ||
.twice | ||
expect(Emailer).to receive(:confirmation_instructions) | ||
.once | ||
.and_return(message_delivery) | ||
allow(message_delivery).to receive(:deliver_later) | ||
# First, create the valid user | ||
post :create, params: valid_user_params | ||
@resource = assigns(:resource) | ||
# Then update the user | ||
expect(message_delivery).to receive(:deliver_later).once | ||
|
||
expect(assigns(:resource).uid).to eq '[email protected]' | ||
|
||
put :update, params: user_update_params | ||
|
||
expect(assigns(:resource).uid).to eq '[email protected]' | ||
|
||
expect(response.status).to eq 200 | ||
end | ||
end | ||
end |