gabriele renzi
2007-Dec-16 09:56 UTC
fixture_file_upload in Integration tests: is it been broken for two years?
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].
[1] http://dev.rubyonrails.org/ticket/4635
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---