def process! #transaction block bankbook = self.bankbooks.build bankbook = user.bank.bankbooks.build bankbook.withdraw #end end
it "should process the withdrawal request" do #something here omit withdrawal.process! @ning.bankbooks.last.price.should == BigDecimal('1.00') @ning.bankbooks.last.action.should == 'withdraw' end bank will withdraw money and bankbook create a record for this withdraw. after a while, I think bankbook should create withdraw item after bank withdraw. so I change the code like following code. def process! #transaction block bank.withdraw #end end # bank model def xxxx bankbook = bankbooks.build bankbook.withdraw end the 'should process the withdrawal request' it's true. but after the change we got two bankbook items. so what's the correct way to create this test? -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users