[rspec-users] "should_not ==" vs "should !="
jimlindley at gmail.com
Mon Jan 21 09:22:04 EST 2008
> I'm 99 44/100% sure that you have it right. The expression x != y is
> syntactic sugar for !(x == y) much like x += y is syntactic sugar for
> x = (x +y)
> The parser turns these into an internal representation (abstract
> syntax tree for 1.8, byte-codes for 1.9) which is identical to the
> second form.
In 1.8 it's just syntactic sugar. But 1.9 provides actual != and !~
methods so that you can override it in situations like this.
(from Ruby-Core: http://www.ruby-forum.com/topic/134608 )
More information about the rspec-users