Class: Lookout::Expect::Classes::Exception
- Defined in:
- lib/lookout-3.0/expect/classes/exception.rb
Overview
Expect block of Lookout::Expected::Classes::Exceptions.
Instance Method Summary collapse
-
#call ⇒ Results::Error, ...
Evaluates the expect block and checks the first raised Exception’s class against the expected Exception class.
Instance Method Details
#call ⇒ Results::Error, ...
Evaluates the expect block and checks the first raised Exception’s class against the expected Exception class. If no exception is raised, the actual result is checked against the expected value.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lookout-3.0/expect/classes/exception.rb', line 13 def call begin result = evaluate_block rescue expected.expected return Lookout::Results::Success.new(file, line) rescue Exception => e exception = Lookout::Exception.new(e) return Lookout::Results::Error. new(file, line, expected.difference(exception.type)., exception) end check(result) rescue Exception => e Lookout::Results::Error.new(file, line, nil, Lookout::Exception.new(e)) end |