Sha256: c2e84afa6aa3dfd0c35074b1102ffeaf107df1cd21393950241d845eaf2b0b6c

Contents?: true

Size: 673 Bytes

Versions: 2

Compression:

Stored size: 673 Bytes

Contents

class ResponseCodeChecker < Checker

  # checks the given responses status code against the one in the expectation and returns result object
  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.error_message = " expected response code --#{@testcase.response_expectation['status_code']}--\n got response code --#{@response.code}--"
      end
    rescue
      result.succeeded = false
      result.error_message = " unexpected error while parsing testcase/response. Check your testcase format!"
    end
    result
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apirunner-0.3.5 lib/plugins/plug02_response_code_checker.rb
apirunner-0.3.4 lib/plugins/response_code_checker.rb