Module | Spec::Expectations::ObjectExpectations |
In: |
lib/spec/expectations/extensions/object.rb
|
rspec adds should and should_not to every Object (and, implicitly, every Class).
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
NOTE that this does NOT support receiver.should != expected. Instead, use receiver.should_not == expected
# File lib/spec/expectations/extensions/object.rb, line 30 30: def should(matcher=:use_operator_matcher, &block) 31: ExpectationMatcherHandler.handle_matcher(self, matcher, &block) 32: end
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
# File lib/spec/expectations/extensions/object.rb, line 53 53: def should_not(matcher=:use_operator_matcher, &block) 54: NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block) 55: end