[rspec-users] fixture_file_upload and edge rspec?

David Chelimsky dchelimsky at gmail.com
Fri Nov 9 07:09:17 EST 2007


On Nov 8, 2007 11:25 PM, Leslie Freeman <lesliefreeman3 at gmail.com> wrote:
> 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',
>
>                       'text/plain')})
>      @image.should_not be_valid
>      # content_type: is not included in the list
>      @image.should have(1).error_on(:content_type)
> end
>
> which fails with:
> 2)
> 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.+
> ./spec/models/image_spec.rb:25:

What's on line 25?

>
> A less than helpful error message. Any insight into what might be
> causing this?
>
> Thanks,
> Les
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list