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
-
#should(*args, &block) ⇒ Assertor
Make an assertion in subjunctive tense.
-
#should!(*args, &block) ⇒ Assertor
(also: #should_not, #shouldnt)
Designate a negated expectation via a functor.
-
#should=(cmp) ⇒ Assertor
Same as ‘object.should == other’.
Instance Method Details
#should(*args, &block) ⇒ Assertor
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) ⇒ Assertor Also known as: should_not, shouldnt
Designate a negated expectation via a functor. Read this as “should not”.
4.should! = 4 #=> Assertion Error
39 40 41 |
# File 'lib/ae/should.rb', line 39 def should!(*args, &block) Assertor.new(self, :backtrace=>caller).not.be(*args, &block) end |