[rspec-users] fixture_file_upload and edge rspec?

Leslie Freeman lesliefreeman3 at gmail.com
Fri Nov 9 00:25:12 EST 2007

Hi all,
I had some specs that were using fixture_file_upload that were  
passing just fine. Then I froze edge rails to get some 2.0  
functionality, then a I upgraded to trunk rspec to deal with

uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper

After a couple other of tribulations, I have now gotten down to just  
a couple of not passing specs, all using the fixture_file_upload.  
Here's an example

it "should be invalid if uploaded file is not an image" do
     @image.attributes = valid_image_attributes.merge({:uploaded_data  
=> fixture_file_upload('/textfile.txt',
     @image.should_not be_valid
     # content_type: is not included in the list
     @image.should have(1).error_on(:content_type)

which fails with:
NoMethodError in 'Image unsaved should be invalid if uploaded file is  
not an image'
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+

A less than helpful error message. Any insight into what might be  
causing this?


More information about the rspec-users mailing list