Hi everyone,
I’m trying to test file uploads (with attachment_fu) in the
integration tests for a rails 2.0.1 application, with code like:
post :action, :data => fixture_file_upload(‘/image.png’, ‘image/
png’)
assert_response :redirect
but this fails with a message
NoMethodError (undefined method `content_type’ for
“#ActionController::TestUploadedFile:0xb6f1a28c”:String):
because the TestUploadFile object is converted to a String with #to_s
in #requestify (integration.rb about line 337). Obviously,
attachment_fu shows this error but the string conversion problem is
general.
I guess TestUploadedFile should be kept in the parameters hash as-is
instead of being converted to #inspect-Strings.
I hope I’m doing something wrong (i.e. there is an argument to post
that I’m missing).
If not, shall it be specified in the documentation for
fixture_file_upload that this does not work with integration tests?
There has been a ticket about it for 2 years, now[1].