Forum: Ruby on Rails Testing file upload

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0f8eb927b2168b8bccf3bea0fec4edaf?d=identicon&s=25 Hans L'hoest (hans)
on 2005-12-20 20:46

I'm having trouble writing tests for a page uploading a file. I have
followed the instructions form the Agile book (p. 363) and the upload
works but I would like to write some tests around it. When I print the
type/class of the file object being created by form it gives me
"IOString", however it is missing the attributes "original_filename" and
"content_type". Since I'm using these, my tests obviously complains. The
book talks about the object being  "an interesting hybrid (file-like
with attributes)" but does not specify more on how to create such an
object (unless I'm missing something, I'm new to Ruby and Rails).
So: how do I create an object like the one returned by the form that I
can use in my tests?

Thank you,

This topic is locked and can not be replied to.