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
-
#should(*args, &block) ⇒ Object
Make an assertion in subjunctive tense.
-
#should!(*args, &block) ⇒ Object
(also: #shouldnt)
Designate a negated expectation via a functor.
-
#should=(cmp) ⇒ Object
Same as ‘object.should == other’.
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
36 37 38 |
# File 'lib/ae/should.rb', line 36 def should!(*args, &block) Assertor.new(self, :backtrace=>caller).not.be(*args, &block) end |
#should=(cmp) ⇒ Object
Same as ‘object.should == other’.
27 28 29 |
# File 'lib/ae/should.rb', line 27 def should=(cmp) Assertor.new(self, :backtrace=>caller).assert == cmp end |