Class: ResponseCodeChecker
- Defined in:
- lib/plugins/plug02_response_code_checker.rb
Instance Method Summary collapse
-
#check ⇒ Object
checks the given responses status code against the one in the expectation and returns result object.
Methods inherited from Checker
available_plugins, #initialize
Constructor Details
This class inherits a constructor from Checker
Instance Method Details
#check ⇒ Object
checks the given responses status code against the one in the expectation and returns result object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/plugins/plug02_response_code_checker.rb', line 4 def check result = Result.new(@testcase, @response) begin if not @testcase.response_expectation['status_code'].to_s == @response.code.to_s result.succeeded = false result. = " expected response code --#{@testcase.response_expectation['status_code']}--\n got response code --#{@response.code}--" end rescue Exception => e result.succeeded = false result. = " unexpected error while parsing testcase/response. Check your testcase format!" result. = "\n\n Exception occured: #{e}" end result end |