Module: AE::Must

Included in:
Object
Defined in:
lib/ae/must.rb

Overview

Note:

THIS IS AN OPTIONAL LIBRARY.

Must

"It is not enough to succeed. Others must fail."
                        --Gore Vidal (1925 - )

Instance Method Summary collapse

Instance Method Details

#must(*args, &block) ⇒ Assertor

The #must method is functionaly the same as #should.

Examples:

4.must == 3  #=> Assertion Error
4.must do
  self == 4
end

Returns:



22
23
24
# File 'lib/ae/must.rb', line 22

def must(*args, &block)
  Assertor.new(self, :backtrace=>caller).be(*args, &block)
end

#must!(*args, &block) ⇒ Assertor Also known as: wont, must_not, mustnt

Designate a negated expectation via a functor. Read this as “must not”.

Examples:

4.must! == 4  #=> Assertion Error

Returns:



40
41
42
# File 'lib/ae/must.rb', line 40

def must!(*args, &block)
  Assertor.new(self, :backtrace=>caller).not.be(*args, &block)
end

#must=(cmp) ⇒ Assertor

Same as ‘object.must == other’.

Returns:



29
30
31
# File 'lib/ae/must.rb', line 29

def must=(cmp)
  Assertor.new(self, :backtrace=>caller) == cmp
end