Module: AE::Should

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

Overview

Note:

THIS IS AN OPTIONAL LIBRARY.

Should

"Always and never are two words you should always
 remember never to use."
                           --Wendell Johnson

Instance Method Summary collapse

Instance Method Details

#should(*args, &block) ⇒ Assertor

Make an assertion in subjunctive tense.

4.should == 3  #=> Assertion Error

4.should do
  self == 4
end

Returns:



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

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

#should!(*args, &block) ⇒ Assertor Also known as: should_not, shouldnt

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

4.should! = 4  #=> Assertion Error

Returns:



39
40
41
# File 'lib/ae/should.rb', line 39

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

#should=(cmp) ⇒ Assertor

Same as ‘object.should == other’.

Returns:



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

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