Sha256: 174fd1ee95299cd3fbaa354c88ab08baef607521495d84a868781e47d60030ee

Contents?: true

Size: 864 Bytes

Versions: 11

Compression:

Stored size: 864 Bytes

Contents

module Matchy
  module Modals
    # Tests an expectation against the given object.
    #
    # ==== Examples
    # 
    #   "hello".should eql("hello")
    #   13.should equal(13)
    #   lambda { raise "u r doomed" }.should raise_error
    #
    def should(expectation = nil)
      Matchy::ExpectationBuilder.build_expectation(true, expectation, self)
    end
    
    alias :will :should
    
    # Tests that an expectation doesn't match the given object.
    #
    # ==== Examples
    # 
    #   "hello".should_not eql("hi")
    #   41.should_not equal(13)
    #   lambda { "savd bai da bell" }.should_not raise_error
    #
    def should_not(expectation = nil)
      Matchy::ExpectationBuilder.build_expectation(false, expectation, self)
    end
    
    alias :will_not :should_not
    alias :wont :should_not
  end
end

Object.send(:include, Matchy::Modals)

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
mhennemeyer-matchy-0.2.0 lib/matchy/modals.rb
mhennemeyer-matchy-0.3.1 lib/matchy/modals.rb
mhennemeyer-matchy-0.3.2 lib/matchy/modals.rb
mhennemeyer-matchy-0.3.3 lib/matchy/modals.rb
mcmire-matchy-0.5.2 lib/matchy/modals.rb
mcmire-matchy-0.5.1 lib/matchy/modals.rb
mcmire-matchy-0.5.0 lib/matchy/modals.rb
jnunemaker-matchy-0.4.0 lib/matchy/modals.rb
mcmire-matchy-0.4.2 lib/matchy/modals.rb
mcmire-matchy-0.4.1 lib/matchy/modals.rb
fcoury-matchy-0.4.0 lib/matchy/modals.rb