Wednesday, August 31, 2011

[Rails] Re: 3.1rc8 - posting files in a test no longer works

> Rails 3.1 enforces that parameters should look like what you'll
> actually get in a test - you used to be able to stick arbitrary
> objects in there which of course doesn't reflect what happens in the
> real world.
> fixture_file_upload should still work


I have a similar problem. Until now I used to assign a
ActionDispatch::Http::UploadedFile to my parameter, which now doesn't
work anymore in rails 3.1.

Unfortunately I cannot use fixture_file_upload because it creates a
Rack::Test::UploadedFile, which doesn't provide #tempfile:

irb> params[:file].class
=> Rack::Test::UploadedFile
irb> params[:file].tempfile
NoMethodError: undefined method `tempfile' for #<Tempfile:0xb6591b70>

There already is a bug report about this problem with
fixture_file_upload: https://github.com/rails/rails/issues/799

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate