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
ActionDispatch::TestProcess needs to access :file_fixture_path on Rails 6.1 #2385
Conversation
Wondering if it makes sense to extend the matrix to run against Rails |
I think it will add lot's of work. What about follow alpha,beta and first releases when they are published?
+1 |
I wasn't sure how rspec-rails has historically coordinated Rails releases.
Having rspec-rails generally track rails master would be a recipe for constant breakage on main, but this would work well for a 6.1 branch. When 6.1 is released, the test target could be switched from master to 6.1. But again, I'm not sure how rspec-rails usually does things.
There will be failing tests aplenty when testing against Rails 6.1. I added a failing test specific to the I'm happy with this remaining open or merged into 6.1 branch is supported. My primary intent was to communicate the problem/fix to others! |
Can you rebase this? |
Adjust spacing of expectation
✅ Rebased Though I'm seeing some sort of Thor failure in the suite, looks like the issue has been on main recently:
|
It's flaky, I've restarted the job, should most probably pass. |
@@ -23,6 +23,7 @@ class RailsFixtureFileWrapper | |||
|
|||
class << self | |||
attr_accessor :fixture_path | |||
attr_reader :file_fixture_path |
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.
If this is only for the next version of rails, we need some kind of feature flag.
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.
Prior versions of Rails do not access file_fixture_path
from within ActionDispatch::TestProcess#fixture_file_upload
. Is there a benefit to not exposing the reader in those cases? Otherwise it feels a bit heavy handed.
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.
These is because the presence of this reader might be seen by other libraries feature detection and the wrong version of Rails assumed, we don't use it ourselves so theres no point having a defined reader that does nothing but might potentially false flag other libraries.
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.
Maybe I'm missing some context, but it doesn't feel right to me to add code to support a hypothetical edge case such as a third party library leaning on this particular class in RSpec to determine a Rails version. However, this is your project, so please feel free to merge / modify / close out this PR as you wish.
@@ -25,6 +25,12 @@ module RSpec::Rails | |||
end | |||
end | |||
|
|||
context 'ActionDispatch::TestProcess on Rails 6.1' do | |||
it 'can read the file_fixture_path attribute' do | |||
expect(FixtureFileUploadSupport::RailsFixtureFileWrapper).to respond_to(:file_fixture_path) |
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.
This explains the how, but not the why, any chance of an integration spec for 6.1? Or do some of our existing integration specs fail on 6.1 for this reason?
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.
Or do some of our existing integration specs fail on 6.1 for this reason?
Exactly, the wrapped class ActionDispatch::TestProcess
requires access to this attribute as of Rails 6.1, otherwise fixture_file_upload bombs out. As to why that class needs to be wrapped in the first place, I'm not sure, that wasn't clear to me from reading through the code / specs.
I'm not sure what the convention is for upcoming releases: is 6.1 running on a branch somewhere? Is it trivial for me to set that up locally?
Thanks for researching this and bringing it to our attention, there was more work needed to ensure it worked without deprecation warning but this is closed in #2398 |
I had a similar problem to @koenpunt in #2349 where
fixture_file_upload
stopped working.In my case, it's because I'm on Rails 6.1 alpha. As of these recent changes,
ActionController::TestCase
now needs access tofile_fixture_path
withinfixture_file_upload
.There's not currently any CI for Rails 6.1 (it's not out yet) but I thought I would get a head start. I added the reader on a separate line, as the
fixture_path
reader is turning into an accessor on #2370.