[rspec-users] Attachment-fu + Story Runner

Daniel Tenner daniel.ruby at tenner.org
Tue Dec 11 09:54:56 EST 2007

Hi Luis,

I read through that thread, but unfortunately it wasn't much help.

fixture_file_upload also creates an  
ActionController::TestUploadedFile. It's is just a shortcut to  

There's no problem with the path - it creates the fixture and loads  
the file, and has the right values inside if I inspect the params  
directly before posting them:

TFile.txt", :uploaded_data=>#<ActionController::TestUploadedFile: 
0x33f83bc @content_type=#<Mime::Type:0x10e2490 @symbol=:text,  
@synonyms=[], @string="text/plain">, @tempfile=#<File:/tmp/ 
test_upload29049-0.txt>, @original_filename="test_upload.txt">}

It's only once this is passed into the controller that it all gets  

I like the idea of 'providing a real file upload', but I'm not sure  
how to do that in a Story... if anyone has any suggestions or  
pointers, they would be welcome!



On 11 Dec 2007, at 14:39 11 Dec 2007, Luis Lavena wrote:

> On Dec 11, 2007 10:57 AM, Daniel Tenner <daniel.ruby at tenner.org>  
> wrote:
>> I've pasted up the code at:
>> http://pastie.caboo.se/126925
>> Since there are quite a few files involved.
>> Thanks for your time,
> A similar discussion was raised back in november (about  
> fixture_file_upload):
> http://rubyforge.org/pipermail/rspec-users/2007-November/004378.html
> Instead of mocking the FileUpload, why not provide a real one?
> After all, the StoryRunner is aimed to fully exercise your code :-D
> Also, adjust the path of your TestFileUpload file location, instead of
> a relative one (../spec/fixtures) provide one related to RAILS_ROOT,
> which will work no matter where you put your helper or what is your
> current directory (Dir.chdir).
> HTH,
> -- 
> Luis Lavena
> Multimedia systems
> -
> A common mistake that people make when trying to design
> something completely foolproof is to underestimate
> the ingenuity of complete fools.
> Douglas Adams
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071211/b140ad3e/attachment-0001.html 

More information about the rspec-users mailing list