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
Rack::Test::UploadedFile should expose :tempfile accessor to be API-compatible with new ActionDispatch::Http::UploadedFile #30
Comments
This broke for me as well when I upgraded our Rails app from 3.0.0 to 3.0.4. |
Scott -- Is the breakage you're referring to is rooted in the Rails change or Rack-Test? Wolfram -- Can you provide a specific example of how this change would be helpful to you? Rack-Test does not aim to be API compatible with Rails generally. |
Hey Bryan, What I was seeing was: NoMethodError: How I got around it was by reopening the Rack::Test::UploadedFile class and exposed tempfile:
Hope it helps. Thanks, Scott |
Hey all, Since this thread has been open and stale for a long time, I'm going to close this out. It's not clear there is a Rack-Test bug here, and Rack-Test does not aim to be API-compatible with Rails. As a general rule, Rack-Test is lower level than ActionPack. If there's a specific bug that can be described in a failing test, please reopen and I can definitely assist. Also, if there's a request for an additional API method to make things easier, please open a separate ticket outlining the desire for the feature. Thanks, |
To test uploading a file without using fixture_file_upload, a posted ActionDispatch::Http::UploadedFile should not be paramified (just like Rack::Test::UploadedFile). (Rack::Test::UploadedFile and ActionDispatch::Http::UploadedFile don't share the same API, tempfile is not accessible on Rack::Test::UploadedFile as discussed in rack/rack-test#30)
To test uploading a file without using fixture_file_upload, a posted ActionDispatch::Http::UploadedFile should not be paramified (just like Rack::Test::UploadedFile). (Rack::Test::UploadedFile and ActionDispatch::Http::UploadedFile don't share the same API, tempfile is not accessible on Rack::Test::UploadedFile as discussed in rack/rack-test#30)
Aaron Patterson's (@tenderlove) rewrite of ActionDispatch::Http::UploadedFile exposes tempfile as an attr_accessor.
Rack::Test::Uploaded file should do the same.
See: rails/rails@c52e2cf
http://marklunds.com/articles/one/433
The text was updated successfully, but these errors were encountered: