Sha256: 8defa8a388459bcaff8cd7cf941011ab70c04377742acd93aa479ff54b94cec2

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 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
    # Make an assertion in subjunctive tense.
    #
    #   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 "should 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

8 entries across 8 versions & 1 rubygems

Version Path
ae-1.7.3 lib/ae/should.rb
ae-1.7.2 lib/ae/should.rb
ae-1.7.1 lib/ae/should.rb
ae-1.7.0 lib/ae/should.rb
ae-1.6.1 lib/ae/should.rb
ae-1.6.0 lib/ae/should.rb
ae-1.5.0 lib/ae/should.rb
ae-1.4.0 lib/ae/subjunctive/should.rb