[rspec-users] Cucumber ".should contain(expected) does but fails anyway

James Byrne lists at ruby-forum.com
Wed Apr 22 12:08:00 EDT 2009

David Chelimsky wrote:

> Ruby. Try this in irb:
> 'this'
> => "this"

This passes:

  assert_equal (expected,
                "#{expected} not found")

This does not:

  fx_doc.xpath('//rdf:RDF/xmlns:channel/xmlns:title').to_s.should \

Or this:

  fx_doc.xpath('//rdf:RDF/xmlns:channel/xmlns:title').to_s.should \

gives this lovely, and illogical error:

      expected "<title>Bank of Canada: Noon Foreign Exchange 
           got "<title>Bank of Canada: Noon Foreign Exchange 

      (compared using equal?)

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/.

More information about the rspec-users mailing list