Class: Lookout::Expected::Exception
- Defined in:
- lib/lookout-3.0/expected/exception.rb
Overview
Represents expected Exceptions.
Instance Method Summary collapse
-
#difference(actual) ⇒ Difference::Exception?
A difference report between ACTUAL and #expected unless they’re #equal? or their classes are ‘#==` and their messages match or #expecteds message is a Regexp that matches actual’s message.
-
#expect(file, line) {|exception| ... } ⇒ Expect::Exception
An expect block for the receiver at LINE in FILE that’ll yield the expected EXCEPTION and expect the exception to be raised.
Instance Method Details
#difference(actual) ⇒ Difference::Exception?
Returns A difference report between ACTUAL and #expected unless they’re #equal? or their classes are ‘#==` and their messages match or #expecteds message is a Regexp that matches actual’s message.
20 21 22 23 24 25 26 27 |
# File 'lib/lookout-3.0/expected/exception.rb', line 20 def difference(actual) Lookout::Difference::Exception.new(actual, expected, regexp) unless expected.equal?(actual) or (expected.class == actual.class and (actual.respond_to? :message rescue false) and (m = actual. rescue nil) and (regexp ? regexp === m : expected. == m)) end |
#expect(file, line) {|exception| ... } ⇒ Expect::Exception
Returns An expect block for the receiver at LINE in FILE that’ll yield the expected EXCEPTION and expect the exception to be raised.
11 12 13 |
# File 'lib/lookout-3.0/expected/exception.rb', line 11 def expect(file, line, &block) Lookout::Expect::Exception.new(self, file, line, &block) end |