On Jul 28, 2011, at 11:40 AM, Roger Pack wrote: >>> 'abc' ~! /def/ > => true > > 'abc'.should !~ /def/ > > fails though. Seemed unexpected... > -roger-
This comes up from time to time but it's a bitch to google for. It boils down to this: the only way to support "actual.should != unexpected" in Ruby 1.8 is to go back and parse the file. This is because == is a method but != is not a method: it's handled by the parser. What that means is this: 5.should == 5 # becomes 5.should.==(5) 5.should != 4 # becomes !(5.should.==(4)) In the latter case the code evaluating 5 == 4 has no way to know that it's been negated. HTH, David _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users