Class: Oncall::DSL::Assertion
- Inherits:
-
Object
- Object
- Oncall::DSL::Assertion
- Defined in:
- lib/oncall/dsl/assertion.rb
Instance Method Summary collapse
-
#initialize(response, method, path) ⇒ Assertion
constructor
A new instance of Assertion.
- #status(expected) ⇒ Object
- #validate(expected) ⇒ Object
Constructor Details
Instance Method Details
#status(expected) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/oncall/dsl/assertion.rb', line 11 def status(expected) result = @response.code == expected.to_s = "#{@method} #{@path}\nexpected: #{expected}\nactual: #{@response.code}" @reporter.report_status(result, ) end |
#validate(expected) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/oncall/dsl/assertion.rb', line 19 def validate(expected) result = JSON::Validator.validate(expected, @response.body) = "#{@method} #{@path}\nexpected: #{expected}\nactual: #{@response.body}" @reporter.report_status(result, ) end |