Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update devise #242

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Update devise #242

wants to merge 5 commits into from

Conversation

bagedevimo
Copy link
Contributor

Required for Rails 5

@bagedevimo bagedevimo force-pushed the 01-05-Update_devise branch from 14cb6a8 to adffc6f Compare January 6, 2024 08:57
@bagedevimo bagedevimo marked this pull request as ready for review January 6, 2024 08:57
Devise 4.0.0 introduced support for Rails 5

Follow up commits will fix deprecations
Devise updated this in version 4.0.0rc1, so this is just bringing us up
to the new system: https://github.com/heartcombo/devise/blob/main/CHANGELOG.md#400rc1---2016-02-01
Devise 4.1.0 fixed a race condition with email sending, where an email
could try to be sent before the record that email is referring too is
not yet persisted [1]. They unfortunately fixed this using an after_commit,
which under Rails 4.2 doesn't work with transactional fixtures [2]. This
is fixed under Rails 5 [3], so we can just comment these out to get this
merged, and get the rails upgrade out, then re-enable these tests.

[1] https://github.com/heartcombo/devise/blob/main/CHANGELOG.md#410
[2] config/spec_helper.rb:34
[3] rails/rails@eb72e34
Devise 4.6.0 deprecated the `devise_error_messages!` helper method in
favour if just rendering a partial including the library. [1]

We can (optionally) copy that partial into our codebase, where we can
edit it, and it will be preferentially used over the one in the gem
code. However, the existing helper had no customisations so I didn't go
down that route yet.

[1] https://github.com/heartcombo/devise/blob/main/CHANGELOG.md#460---2019-02-07
Devise 4.2.0 deprecated the Devise::TestHelpers module in favour of the
Devise::Test::ControllerHelpers module, which is because they wanted to
split the different test helpers into different modules.

https://github.com/heartcombo/devise/blob/main/CHANGELOG.md#420---2016-07-01
@bagedevimo bagedevimo force-pushed the 01-05-Update_devise branch from adffc6f to 9bedc8e Compare January 6, 2024 08:58
@coveralls
Copy link

Coverage Status

coverage: 37.131%. remained the same
when pulling 9bedc8e on 01-05-Update_devise
into 57b299d on master.

Copy link
Member

@Holmes98 Holmes98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, other than the lint issues. I have slight preference to using test_after_commit over commenting out the specs, but I don't feel particularly strongly about it.

@@ -1,30 +1,36 @@
require 'spec_helper'

describe Accounts::RegistrationsController do
it "can get signup form" do
it 'can get signup form' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason for changing to single quotes? standardrb seems to prefer double quotes:

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping

post :create, :user => { :username => "signup_username", :name => "Mr. SignUp", :email => "[email protected]", :password => "password", :password_confirmation => "password" }
end.to change{User.count}.by(1)
post :create,
user: { username: 'signup_username', name: 'Mr. SignUp', email: '[email protected]', password: 'password',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also fails lint:

Layout/ArgumentAlignment: Use one level of indentation for arguments following the first line of a multi-line method call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants