Kernel

Public Instance Methods

should(matcher) click to toggle source
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 RSpec::Matchers for more information about matchers

Warning

NOTE that this does NOT support receiver.should != expected. Instead, use receiver.should_not == expected

# File lib/rspec/expectations/extensions/kernel.rb, line 26
def should(matcher=nil, message=nil, &block)
  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
end
should_not(matcher) click to toggle source
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 RSpec::Matchers for more information about matchers

# File lib/rspec/expectations/extensions/kernel.rb, line 49
def should_not(matcher=nil, message=nil, &block)
  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.