> In your original post you said you were getting two bankbook items after
> the change. Do you want one or two? And where is the 2nd one coming
> from?
I always want one . after change the code I got two. and the original
test doesn't fail.
def process!
#transaction block
bank.withdraw
bankbook = user.bank.bankbooks.build
bankbook.withdraw
#end
end
#change version
def process!
#transaction block
bank.withdraw
#end
end
so obviously, bankbook = user.bank.bankbooks.build create a bankbook
record. and bank.withdraw jsut about decrease money.
after change. bank.withdraw Model#withdraw the withdraw method will
create bankbook record. so we just don't need create bankbook in
process! but my test is
@ning.bankbooks.last.price.should == BigDecimal('1.00')
@ning.bankbooks.last.action.should == 'withdraw'
it doesn't care how many bankbook record was created.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users