[rspec-users] Attachment-fu + Story Runner
daniel.ruby at tenner.org
Tue Dec 11 12:30:58 EST 2007
I've now located where this is going wrong, though I am not yet sure
how to fix it.
In rails' integration.rb, there is a method called 'process'. around
line 226. It mangles the parameters by calling:
data = requestify(parameters)
a bit later reveals the problem:
0x3434150 @content_type="text/plain", @tempfile=#<File:/tmp/
Obviously that's not going to work. I wonder how Test::Unit does it,
On 11 Dec 2007, at 14:54 11 Dec 2007, Daniel Tenner wrote:
> 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>
>>> I've pasted up the code at:
>>> Since there are quite a few files involved.
>>> Thanks for your time,
>> A similar discussion was raised back in november (about
>> 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).
>> 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
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users