Class: Allgood::Expectation
- Inherits:
-
Object
- Object
- Allgood::Expectation
- Defined in:
- lib/allgood/configuration.rb
Instance Method Summary collapse
-
#initialize(actual) ⇒ Expectation
constructor
A new instance of Expectation.
- #to_be_greater_than(expected) ⇒ Object
- #to_be_less_than(expected) ⇒ Object
- #to_eq(expected) ⇒ Object
Constructor Details
#initialize(actual) ⇒ Expectation
Returns a new instance of Expectation.
189 190 191 |
# File 'lib/allgood/configuration.rb', line 189 def initialize(actual) @actual = actual end |
Instance Method Details
#to_be_greater_than(expected) ⇒ Object
201 202 203 204 205 206 207 |
# File 'lib/allgood/configuration.rb', line 201 def to_be_greater_than(expected) if @actual > expected { success: true, message: "Got: #{@actual || 'nil'} (> #{expected})" } else raise CheckFailedError.new("We were expecting #{@actual || 'nil'} to be greater than #{expected} but it's not") end end |
#to_be_less_than(expected) ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/allgood/configuration.rb', line 209 def to_be_less_than(expected) if @actual < expected { success: true, message: "Got: #{@actual || 'nil'} (< #{expected})" } else raise CheckFailedError.new("We were expecting #{@actual || 'nil'} to be less than #{expected} but it's not") end end |
#to_eq(expected) ⇒ Object
193 194 195 196 197 198 199 |
# File 'lib/allgood/configuration.rb', line 193 def to_eq(expected) if @actual == expected { success: true, message: "Got: #{@actual || 'nil'}" } else raise CheckFailedError.new("Expected #{expected} to equal #{@actual || 'nil'} but it doesn't") end end |