RĂ©mi Gagnon
2008-Oct-06 14:27 UTC
[rspec-users] Newbie question about mock_model and should_receive....
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 -- Posted via http://www.ruby-forum.com/.
Pat Maddox
2008-Oct-06 15:03 UTC
[rspec-users] Newbie question about mock_model and should_receive....
R?mi Gagnon <lists at ruby-forum.com> writes:> 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?miIn 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