On Mon, Sep 28, 2009 at 12:02 PM, Oliver Barnes
<oli.azevedo.bar...@gmail.com> wrote:
> thanks! had given up on this already. changing to the new syntax
>
>  Image.stub!(:find, :return => @image)

Not sure where you got this syntax from, but it doesn't do anything.
Options are:

Image.stub(:find).and_return(@image)
Image.stub(:find => @image)
Image.stub(:find) { @image }

You can also use stub! in all 3 forms.

>
> did get me past the error.
>
> I still can't get this spec to pass though:
>
> http://pastie.org/633580
>
> updated spec:
>
> http://pastie.org/633584
>
> and the controller being spec'ed:
>
> http://pastie.org/633586
>
>
>
>
>
> 2009/9/26 Borja Martín <bor...@dagi3d.net>:
>> Hi,
>> I got the same error while writing an extension for Spree and found this
>> thread through Google. It seems it's caused by the jeremymcanally-stump[1]
>> gem used by the application. You should use the syntax shown in the
>> documentation
>>
>> http://github.com/jeremymcanally/stump
>>
>> Regards
>>
>> On Wed, Aug 26, 2009 at 1:19 AM, Oliver Barnes
>> <oli.azevedo.bar...@gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> I'm struggling with this controller spec for a few hours now
>>>
>>> http://pastie.org/594775
>>>
>>> which is failing with an error I can't find any references about,
>>> neither on the list nor on the web in general:
>>>
>>> Admin::ImagesController handling PUT /images/1 with successful update
>>> should find the image requested
>>> undefined method `and_return' for #<Proc:0x30520b4>
>>>
>>> /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17
>>> /tmp/textmate-command-1859.rb:3
>>> 15      before(:each) do
>>> 16       �...@image = mock_model(Image, :to_param => "1")
>>> 17        Image.stub!(:find).and_return(@image)
>>> 18      end
>>>
>>> why would and_return() not be recognized, while stub!() is?
>>>
>>> has anybody experienced this problem before? I'm using rspec and
>>> rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing
>>> Spree 0.8.99
>>>
>>> thanks
>>> Oliver
>>> _______________________________________________
>>> rspec-users mailing list
>>> rspec-users@rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>>
>>
>> --
>> def dagi3d(me)
>>  case me
>>    when :web then  "http://dagi3d.net";
>>    when :twitter then "http://twitter.com/dagi3d";
>>  end
>> end
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to