[rspec-users] should and != operator

s.ross cwdinfo at gmail.com
Mon Oct 12 16:25:28 EDT 2009


It's not a bug. Consider:

"abc".should eql("abc") <= pass
"abc".should_not eql("def") <= pass

But eql() is a Ruby method. In Pickaxe, you'll see that other  
comparators such as != >= etc. Are not implemented as overridable  
methods.

Hope this clarifies.

Hunted and pecked from my iPhone

On Oct 12, 2009, at 12:11 PM, Bret Pettichord <bret at pettichord.com>  
wrote:

> Looks like an rspec bug to me.
>
> Bret
>
> Willy Mene wrote:
>> I've tried searching around for something describing how the  
>> #should method works with the != operator, but couldn't find  
>> anything conclusive.  Can someone please explain while the  
>> following lines will pass if placed into an rspec example?
>>
>> it "should fail but passes" do
>>  [].should != []
>>  'some string'.should != 'some string'
>> end
>>
>> Thanks!
>> Willy
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list