Forum: RSpec Newbie question about mock_model and should_receive....

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
161c0829c95d759f4dc0e0b71f712109?d=identicon&s=25 Rémi Gagnon (rgagnon)
on 2008-10-06 16:27
Hello,

I mocked a model and I need to test when I set for instance '000' to an
attribute 'A' that B attibute is set to '1111'.  I don't want to stub or
mock the B(accessors) to that value cause I want to make sure my
controller will do that.

I know its dummy question.

suggestions?


Rémi
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2008-10-06 17:34
(Received via mailing list)
Rémi Gagnon <lists@ruby-forum.com> writes:

>
>
> Rémi

In that case, you want to use the real object.  The spec would be pretty
simple:

it "should set B when A is set" do
  MyModel.new(:a => '000').b.should == '1111'
end

Pat
This topic is locked and can not be replied to.