On Apr 2, 2011, at 6:20 AM, Kai Schlamp wrote:
> I use RSpec mock and stub like this:
>
> hit = mock("hit", :stored => 5)
>
> This works fine, but when using this instead:
>
> hit = mock("hit").stub(:stored) { 5 }
Not that it's really necessary, but to make this work you can do:
hit = mock('h
> hit = mock('hit')
> hit.stub(:stored) { 5 }
> hit.stored.should eq(5)
>
> Make sense?
Of course :-) Thanks.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
On Apr 2, 2011, at 8:20 AM, Kai Schlamp wrote:
> I use RSpec mock and stub like this:
>
> hit = mock("hit", :stored => 5)
>
> This works fine, but when using this instead:
>
> hit = mock("hit").stub(:stored) { 5 }
>
> then I get
>
> undefined method `stored' for # 0xb688bb78>
>
> I always th
I use RSpec mock and stub like this:
hit = mock("hit", :stored => 5)
This works fine, but when using this instead:
hit = mock("hit").stub(:stored) { 5 }
then I get
undefined method `stored' for #
I always thought both were equivalent. Can someone enlighten me?
Regards,
Kai
__