Module Spec::Expectations::ObjectExpectations
In: lib/spec/expectations/extensions/object.rb

rspec adds should and should_not to every Object (and, implicitly, every Class).

Methods

should   should_not  

Public Instance methods

  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

[Source]

    # File lib/spec/expectations/extensions/object.rb, line 31
31:       def should(matcher=nil, &block)
32:         return ExpectationMatcherHandler.handle_matcher(self, matcher, &block) if matcher
33:         Spec::Matchers::PositiveOperatorMatcher.new(self)
34:       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

[Source]

    # File lib/spec/expectations/extensions/object.rb, line 55
55:       def should_not(matcher=nil, &block)
56:         return NegativeExpectationMatcherHandler.handle_matcher(self, matcher, &block) if matcher
57:         Spec::Matchers::NegativeOperatorMatcher.new(self)
58:       end

[Validate]