Sha256: 627cf1c50ac18e28f259fd51bb82583f2c5def51b8754da2c552493351f67d20

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

module Kernel
  # :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=nil, &block)
    Spec::Expectations::PositiveExpectationHandler.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=nil, &block)
    Spec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, &block)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-1.2.3 lib/spec/expectations/extensions/kernel.rb
rspec-1.2.5 lib/spec/expectations/extensions/kernel.rb
rspec-1.2.4 lib/spec/expectations/extensions/kernel.rb
rspec-1.2.6 lib/spec/expectations/extensions/kernel.rb