hi guys,
I’m reading up on Rspec, Mocha and some related material to put BDD
in my new rails app.
I have also checked out Ryan B.’ railscasts on rspec (that’s how I
got to know about Mocha).
Reading up on the Rspec’s main site, the main example in
http://rspec.rubyforge.org/rspec/1.3.0/ does not show any use of
assert_equals. Rather it just uses the “==” comparison operators.
Here’s an extract:
============ Extract begin ===========================
it "reduces its balance by the transfer amount" do
source = Account.new(50, :USD)
target = stub('target account')
source.transfer(5, :USD).to(target)
source.balance.should == Money.new(45, :USD) <----- here
end
end
end
============ Extract end ===========================
Newbie question (don’t shoot me cause I tried reading up and can’t
find out why): Why do folks still use assert_equal if the comparison
operators (apart from that there’s a Test::Unit::Assertions module
(http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit/
Assertions.html) written for it)?