Class: Liltest::Expectation
- Inherits:
-
Object
- Object
- Liltest::Expectation
- Defined in:
- lib/liltest/expectation.rb
Instance Attribute Summary collapse
-
#failed_reason ⇒ Object
readonly
Returns the value of attribute failed_reason.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(value) ⇒ Expectation
constructor
A new instance of Expectation.
- #to_eq(expectation) ⇒ Object
Constructor Details
#initialize(value) ⇒ Expectation
Returns a new instance of Expectation.
5 6 7 |
# File 'lib/liltest/expectation.rb', line 5 def initialize(value) @value = value end |
Instance Attribute Details
#failed_reason ⇒ Object (readonly)
Returns the value of attribute failed_reason.
3 4 5 |
# File 'lib/liltest/expectation.rb', line 3 def failed_reason @failed_reason end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/liltest/expectation.rb', line 3 def value @value end |
Instance Method Details
#failed? ⇒ Boolean
16 17 18 |
# File 'lib/liltest/expectation.rb', line 16 def failed? !!@failed_reason end |
#to_eq(expectation) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/liltest/expectation.rb', line 9 def to_eq(expectation) if value != expectation @failed_reason = "Expected '#{value}' to equal '#{expectation}', but it was '#{value}'" raise "Failed" end end |