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?