David Chelimsky wrote:
> Ruby. Try this in irb:
>
> 'this'
> => "this"
This passes:
assert_equal (expected,
fx_doc.xpath('//rdf:RDF/xmlns:channel/xmlns:title').to_s,
"#{expected} not found")
This does not:
fx_doc.xpath('//rdf:RDF/xmlns:channel/xmlns:title').to_s.should \
contain(expected)
Or this:
fx_doc.xpath('//rdf:RDF/xmlns:channel/xmlns:title').to_s.should \
equal(expected)
gives this lovely, and illogical error:
expected "<title>Bank of Canada: Noon Foreign Exchange
Rates</title>"
got "<title>Bank of Canada: Noon Foreign Exchange
Rates</title>"
(compared using equal?)
(Spec::Expectations::ExpectationNotMetError)
Do not even start on how equal? in Ruby is defined completely at odds
with common usage. I am just pointing out that this type of thing
definitely violates the principal of least surprise.
So, test unit it is.
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users