Class: Expect::ExpectBase Abstract
- Inherits:
-
Object
- Object
- Expect::ExpectBase
- Defined in:
- lib/expect.rb
Overview
This class is abstract.
Base class for Expects. Override #run to implement the validation logic.
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#expected ⇒ Object
Returns the value of attribute expected.
Instance Method Summary collapse
-
#initialize(actual:, expected: nil) ⇒ ExpectBase
constructor
A new instance of ExpectBase.
-
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult.
Constructor Details
#initialize(actual:, expected: nil) ⇒ ExpectBase
Returns a new instance of ExpectBase.
12 13 14 15 |
# File 'lib/expect.rb', line 12 def initialize(actual:, expected: nil) @actual = actual @expected = expected end |
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual.
8 9 10 |
# File 'lib/expect.rb', line 8 def actual @actual end |
#expected ⇒ Object
Returns the value of attribute expected.
8 9 10 |
# File 'lib/expect.rb', line 8 def expected @expected end |
Instance Method Details
#run ⇒ AssertPass, AssertFailure
Runs the validator and returns an AssertResult
19 20 21 |
# File 'lib/expect.rb', line 19 def run AssertFailure.new("No expectation defined for #{@actual}.") end |