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

Upgrade to Rails 7 #5762

Merged
merged 7 commits into from Jul 28, 2022
Merged

Upgrade to Rails 7 #5762

merged 7 commits into from Jul 28, 2022

Conversation

mitchellhenke
Copy link
Contributor

@mitchellhenke mitchellhenke commented Dec 29, 2021

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/rails-7 branch 3 times, most recently from 1c0dc32 to dc29e91 Compare December 29, 2021 20:27
.circleci/config.yml Outdated Show resolved Hide resolved
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/rails-7 branch 3 times, most recently from 2d702a5 to a437d73 Compare May 19, 2022 15:21
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/rails-7 branch 4 times, most recently from a729d9b to 35aba3d Compare June 2, 2022 01:57
@mitchellhenke mitchellhenke changed the title WIP: Upgrade to Rails 7 Upgrade to Rails 7 Jul 20, 2022
@mitchellhenke mitchellhenke marked this pull request as ready for review July 20, 2022 19:29
@@ -62,8 +62,6 @@ lint: ## Runs all lint tests
make lint_analytics_events
@echo "--- brakeman ---"
bundle exec brakeman
@echo "--- zeitwerk check ---"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is no longer needed since the classic loader no longer exists in Rails 7

@@ -172,6 +172,7 @@
stub_analytics
stub_sign_in(user)
allow(IdentityConfig.store).to receive(:domain_name).and_return('localhost:3000')
request.host = 'localhost:3000'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is required to ensure that the webauthn domain name does not conflict with the host in the request, otherwise we get (and also because this isn't a request where we want to allow other hosts):

ActionController::Redirecting::UnsafeRedirectError:
       Unsafe redirect to "http://localhost/account", pass allow_other_host: true to redirect anyway.

@@ -43,9 +43,9 @@
'script[type="application/json"][data-asset-map]',
visible: :all,
text: {
'clock.svg' => '/clock.svg',
'clock.svg' => 'http://test.host/clock.svg',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is due to request now existing when the function is called in this spec here:

elsif request
request.base_url
end

I'm not sure why it would have changed, but I don't think it affects the primary motivation behind the test?

# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have been stable on 6.1 for some time now 🙂

only_option = if_option_for(action)[0]

"#{only_option.class}OptionParser".constantize.new(only_option).parse
if_option_for(action)[0]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll be honest, I don't have confidence in my understanding of this file's metaprogramming, and I'd rather see us test the behaviors around the before_actions via controller specs than ensure a method is called.

Copy link
Contributor

Choose a reason for hiding this comment

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

omg I didn't realize this file was parsing the source, and not just introspecting the controller in memory. but +1 would rather see something like expect(controller).to receive(:some_action).and_call_original

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's passing around a bunch of stuff and has to call instance_variable_get to get private instance variables, which isn't ideal and it's hard to follow the process. I don't mind it as kind of a simpler check if it was well-supported, but it's unfortunately not the case.

It is used pretty extensively though.

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM!

@mitchellhenke mitchellhenke merged commit c6ccbf1 into main Jul 28, 2022
@mitchellhenke mitchellhenke deleted the mitchellhenke/rails-7 branch July 28, 2022 16:10
@solipet solipet mentioned this pull request Aug 9, 2022
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.

None yet

2 participants