Ruby on Rails Tuesday, August 30, 2011

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:

(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 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.

No comments:

Post a Comment