Sha256: 944bc341f266d7a4c6bc09da85c86be6a2e80d0ad5d2ba135615b83af259db40

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

require 'api-tester/reporter/status_code_report'
require 'api-tester/modules/module'
require 'api-tester/method_case_test'

module ApiTester
  class Format < Module
    def go definition, report
      super

      definition.methods.each do |method|
        cases = method.request.cases
        cases.each do |format_case|
          response = definition.call method, format_case.payload, format_case.headers
          test = FormatTest.new response, format_case.payload, definition.bad_request_response, definition.url, method.verb
          self.report.reports.concat test.check
        end
      end

      report.reports == []
    end
  end

  class FormatTest < MethodCaseTest
      def initialize response, payload, expected_response, url, verb
          super response, payload, expected_response, url, verb, "FormatModule"
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
api-tester-0.2.0 lib/api-tester/modules/format.rb