[rspec-users] there should be one test or two?

Zhenning Guan lists at ruby-forum.com
Fri Aug 27 01:43:36 EDT 2010


in real world, when user deposit money into their bank, bank have money
and can check deposit record. so what would it be in rspec?

it 'should be deposit $10'
  user.bank.deposit(10)
  user.bank.deposit.saving.should == 10
end

about test , should be deposit $10 is clear? maybe 'should deposit $10
success'?

and when deposit, we should have a deposit record. added another test?

it 'should be a deposit record when deposit $10'
  user.bank.deposit(10)
  user.deposit_record.should == #something.
end

or just mixed it in one test?

it 'should be deposit $10'
  user.bank.deposit(10)
  user.bank.deposit.saving.should == 10
  user.deposit_record.should == #something.
end
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list