[rspec-users] should and != operator

Tero Tilus tero at tilus.net
Mon Oct 12 15:18:56 EDT 2009


2009-10-12 11:33, Willy Mene:
> I've tried searching around for something describing how the #should  
> method works with the != operator

Afaik it doesn't.  I have led to believe this is because there is no
method '!='.  Expression x!=y is instead just syntactic sugar for
!(x==y).

> it "should fail but passes" do
>   [].should != []
>   'some string'.should != 'some string'
> end

How about

it "fails now" do
  [].should_not == []
  'some string'.should_not == 'some string'
end

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/


More information about the rspec-users mailing list