Sha256: 6c96cdf4e4057b6137635eebd731f7afe588110fe050548a72bb701d890d4c07

Contents?: true

Size: 1.11 KB

Versions: 5

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(*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

5 entries across 5 versions & 1 rubygems

Version Path
ae-1.2.3 lib/ae/subjunctive/should.rb
ae-1.2.2 lib/ae/subjunctive/should.rb
ae-1.2 lib/ae/subjunctive/should.rb
ae-1.1.0 lib/ae/subjunctive/should.rb
ae-1.0.0 lib/ae/subjunctive/should.rb