Class: Lookout::Expected::Object
- Defined in:
- lib/lookout-3.0/expected/object.rb
Overview
Represents expected Objects. This is the base expected-value class and may be subclassed if you have a type that would benefit from more specific treatment than what this class affords. Such a subclass should override #expect and/or #difference to set up type-specific expect blocks and/or difference checks and difference report generation.
Direct Known Subclasses
Array, Classes::Exception, Exception, FalseClass, Hash, Lookout::Actual::Method, Lookout::Actual::Not::Method, Lookout::Output, Lookout::Reception, Lookout::Warning, Module, Range, Regexp, String, Symbol, TrueClass
Instance Method Summary collapse
-
#difference(actual) ⇒ Difference::Object?
A difference report between ACTUAL and #expected unless they’re ‘#==`.
-
#expect(file, line, &block) ⇒ Expect::Object
An expect block for the receiver at LINE in FILE that’ll yield the #expected object and expect an object that’ll exhibit no #differences from it to be returned.
Instance Method Details
#difference(actual) ⇒ Difference::Object?
Returns A difference report between ACTUAL and #expected unless they’re ‘#==`.
27 28 29 |
# File 'lib/lookout-3.0/expected/object.rb', line 27 def difference(actual) Lookout::Difference::Object.new(actual, expected) unless expected == actual end |
#expect(file, line, &block) ⇒ Expect::Object
Returns An expect block for the receiver at LINE in FILE that’ll yield the #expected object and expect an object that’ll exhibit no #differences from it to be returned.
20 21 22 |
# File 'lib/lookout-3.0/expected/object.rb', line 20 def expect(file, line, &block) Lookout::Expect::Object.new(self, file, line, &block) end |