Module: AE::Should

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

Overview

Should

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

THIS IS AN OPTIONAL LIBRARY.

Instance Method Summary collapse

Instance Method Details

#should(*args, &block) ⇒ Object

Make an assertion in subjunctive tense.

4.should == 3  #=> Assertion Error

4.should do
  self == 4
end


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) ⇒ Object Also known as: shouldnt

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

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


31
32
33
# File 'lib/ae/should.rb', line 31

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