-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Allow Rails 6.1 #2047
Allow Rails 6.1 #2047
Conversation
Unfortunately there are some failing tests. I was looking into it focusing on the recurring Rails 6.1 includes changes related to controller helper methods which is causing the error. I opened an issue in the rspec-rails repo as they might need to adapt to the changes as well. Let's see if it can be solved easily. |
de53793
to
74f23b6
Compare
8da0726
to
6b3eb00
Compare
5496b17
to
fdf8c31
Compare
@robinboening used the GH Draft feature to note that this PR is still WIP. I hope you don't mind :) |
94cf45c
to
0af4cef
Compare
Now that a shoulda-matchers version has been released and merged in #2161 that supports Rails 6.1 and Ruby 3 maybe some of the failing specs pass now? A rebase with latest |
Any news on that? I could rebase myself, but I don't want to "steal" others work :P |
1162710
to
a4c301e
Compare
As far as I can tell almost all the tests are failing for the same reason. In some places in the specs we inject helper methods to the controller. This pattern doesn't seem to work any longer with Rails 6.1, very likely because the view context is already created at the time when the include is sent to the controller. |
5bcd781
to
5fcf414
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What baffles me are that there are specs failing for Rails 6.0 as well that are passing in main
, so there might be another issue?
Reagarding the view specs we might need to stub even more helper methods? Maybe Rails 6.1 stopped injecting any helpers into the view context? The same might be true with the helper specs.
2536217
to
8477593
Compare
@robinboening I pushed a fix for the picture ingredient editor spec. 0a485ff |
UPDATE Three failing specs for 6.1
One failing spec in Rails 6.0
As always no clues in the change logs. And why is a 6.0 related spec failing. |
6bc1f0f
to
3682f09
Compare
FYI: I just rebased with current |
A couple of weeks back I've added a commit just for testing if it fixes some helper tests. It did if I remember correctly, but it is considered a hacky approach and should be avoided as John Hawthorn states rails/rails#40204 (comment) I haven't had the time to drill deeper into that so I haven't found a better solution. |
@robinboening I added two commits 2acb952 and 0915db8 that made that not necessary anymore |
I fixed a couple of specs, but there is one bug in Rails: In SELECT "alchemy_elements".* FROM "alchemy_elements" WHERE "alchemy_elements"."parent_element_id" = 91 AND "alchemy_elements"."public" = TRUE ORDER BY "alchemy_elements"."position" ASC; This is the collection returned by Rails [#<Alchemy::Element:0x00005621e3a0ae50
id: 92,
name: "article",
position: 1,
public: true,
folded: false,
unique: false,
created_at: Thu, 02 Sep 2021 07:56:42.502623000 UTC +00:00,
updated_at: Thu, 02 Sep 2021 07:56:42.502623000 UTC +00:00,
creator_id: nil,
updater_id: nil,
parent_element_id: 91,
fixed: false,
page_version_id: 196,
tag_names: nil>,
#<Alchemy::Element:0x00005621e2cf3e60
id: 93,
name: "article",
position: 2,
public: false,
folded: false,
unique: false,
created_at: Thu, 02 Sep 2021 07:56:42.507076556 UTC +00:00,
updated_at: Thu, 02 Sep 2021 07:56:42.507076556 UTC +00:00,
creator_id: nil,
updater_id: nil,
parent_element_id: 91,
fixed: false,
page_version_id: 196,
tag_names: nil>] You clearly can see that Rails is not respecting the Thank you, Rails! |
Fixed all specs besides one. The |
This feature spec failed with Rails 6.1 as it was defaulting to example.com instead of 127.0.0.1. Setting `asset_host` inside the test is more explicit as it was before and reflects what an actual app does.
27024e0
to
6001d60
Compare
Those helpers are not included by Rails anymore. Since a view spec is a unit test we need to stub/include everything we need on ourselves.
First create elements with the page_version (the direct relation) and not a page (an indirect join via the page_version). Also reload element in nested_elements spec. Somehow this is now necessary in Rails 6.1.
Instead of globally including a module into the tet controller we stub the one method the spec uses
It is not necessary. The specs pass without globally including a module in the test controller
Instead of expecting that rails calls a method on the receiver we expect that the updated_at time has changed.
Not everybody is using a db running on host but on a socket instead.
Wohooo. We got it. Thanks @robinboening for the initial work. |
For now, this PR is supposed to be a draft for investigating the extend of supporting Rails 6.1 and eventually getting it ready to be merged into
main
.