Sha256: 177ec3d8c6e009012e7769a3f882b63351f76f20bf9d3bb56519b9cb1567f76b
Contents?: true
Size: 1.87 KB
Versions: 6
Compression:
Stored size: 1.87 KB
Contents
module Spec module Expectations # rspec adds #should and #should_not to every Object (and, # implicitly, every Class). module ObjectExpectations # :call-seq: # should(matcher) # should == expected # should === expected # should =~ expected # # receiver.should(matcher) # => Passes if matcher.matches?(receiver) # # receiver.should == expected #any value # => Passes if (receiver == expected) # # receiver.should === expected #any value # => Passes if (receiver === expected) # # receiver.should =~ regexp # => Passes if (receiver =~ regexp) # # See Spec::Matchers for more information about matchers # # == Warning # # NOTE that this does NOT support receiver.should != expected. # Instead, use receiver.should_not == expected def should(matcher=:use_operator_matcher, &block) ExpectationMatcherHandler.handle_matcher(self, matcher, &block) end # :call-seq: # should_not(matcher) # should_not == expected # should_not === expected # should_not =~ expected # # receiver.should_not(matcher) # => Passes unless matcher.matches?(receiver) # # receiver.should_not == expected # => Passes unless (receiver == expected) # # receiver.should_not === expected # => Passes unless (receiver === expected) # # receiver.should_not =~ regexp # => Passes unless (receiver =~ regexp) # # See Spec::Matchers for more information about matchers def should_not(matcher=:use_operator_matcher, &block) NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block) end end end end class Object include Spec::Expectations::ObjectExpectations end
Version data entries
6 entries across 6 versions & 2 rubygems