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

James Byrne lists at ruby-forum.com
Wed Apr 22 16:35:27 EDT 2009

David Chelimsky wrote:

> I like the idea, though I think it's helpful to also have the strings
> in the case of String objects. But having the class and object id
> would really help tell the story we're looking for.

The relationship between "#<Class:#<String:0x2b22de53e018>>" and the 
object's id is rather bizarre.

irb(main):022:0> x.metaclass
=> #<Class:#<String:0x2b22de53e018>>
irb(main):023:0> x.object_id
=> 23714379460620
irb(main):024:0> 0x2b22de53e018.to_s(10)
=> "47428758921240"
irb(main):025:0> 0x2b22de53e018.to_i
=> 47428758921240
irb(main):026:0> 23714379460620 * 2
=> 47428758921240

Obviously an extra bit is getting set somewhere; or unset in #object_id.
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list