# Fixture\_file\_upload in Integration tests: is it been broken for two years?

**URL:** <https://www.ruby-forum.com/t/fixture-file-upload-in-integration-tests-is-it-been-broken-for-two-years/123319>\
**Category:** Rails\
**Created:** [December 16, 2007, 10:57am UTC](https://www.ruby-forum.com/t/fixture-file-upload-in-integration-tests-is-it-been-broken-for-two-years/123319 "2007-12-16T10:57:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriele\_renzi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e19b73/32.png) [@gabriele\_renzi](https://www.ruby-forum.com/u/gabriele_renzi)\
**Post date:** [December 16, 2007, 10:57am UTC](https://www.ruby-forum.com/t/fixture-file-upload-in-integration-tests-is-it-been-broken-for-two-years/123319/1 "2007-12-16T10:57:04Z")

</div>

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](http://dev.rubyonrails.org/ticket/4635)
