[rspec-users] New bie question: Why use assert_equal when there are comparison operators in Rspec?

ct9a anexiole at gmail.com
Thu Aug 5 22:52:24 EDT 2010

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 Bates' 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
============ 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
Assertions.html) written for it)?

More information about the rspec-users mailing list