On Aug 31, 2:22 am, Josh <[email protected]> wrote: > A previously working test, that posted a file object no longer works > in the latest 3.1. The test looks like this: > > params[:media][:new_attachment] = File.open("#{Rails.root}/test/data/ > less_than_100.png") > post :create, params > > In the controller, I obviously expect params[:media][:new_attachment] > to be a File object - and it used to be. Now it looks like #inspect > has been called on the file. Debugging out in the test: >
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 Fred > (rdb:1) params[:media].try(:[], :new_attachment) > "#<File:0x007fcd0a950658>" > (rdb:1) params[:media].try(:[], :new_attachment).class > String > > Yep, what's up with that? -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

