Sha256: 46071d4b5f290ee0bda78f03ee7d7713a0310fe63e26ffcd041e7a4566a5fcc2

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'ae/subjunctive'

module AE

  # = Should
  #
  #  "Always and never are two words you should always
  #   remember never to use."
  #                              --Wendell Johnson
  #
  # THIS IS AN OPTIONAL LIBRARY.
  #
  module Should
    # The #must method is functionaly the same as #should.
    #
    #   4.should == 3  #=> Assertion Error
    #
    #   4.should do
    #     self == 4
    #   end
    #
    def should(*args, &block)
      Assertor.new(self, :backtrace=>caller).be(*args, &block)
    end

    # Designate a negated expectation via a *functor*.
    # Read this as "must not".
    #
    #   4.should! == 4  #=> Assertion Error
    #
    def should!(*args, &block)
      Assertor.new(self, :backtrace=>caller).not.be(*args, &block)
    end

    # Not quite the literally the counter-term to *should* (rather *shall*), but
    # it is close enough for our purposes and conveys the appropriate semantics.
    #alias_method :shant, :should!

    # Alias for #should! method.
    alias_method :shouldnt, :should!
  end

end

class ::Object #:nodoc:
  include AE::Should
end

# Copyright (c) 2008,2009 Thomas Sawyer

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ae-1.3.0 lib/ae/subjunctive/should.rb