Sha256: 6dd45c972d458ae668175d733c60f9de346342d4e08b75eabc89d4c4b94e8778

Contents?: true

Size: 888 Bytes

Versions: 4

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

require 'open_api/rswag/specs/request_factory'
require 'open_api/rswag/specs/response_validator'

module OpenApi
  module Rswag
    module Specs
      module ExampleHelpers
        def submit_request(metadata)
          request = RequestFactory.new.build_request(metadata, self)

          if RAILS_VERSION < 5
            send(
                request[:verb],
                request[:path],
                request[:payload],
                request[:headers]
            )
          else
            send(
                request[:verb],
                request[:path],
                params: request[:payload],
                headers: request[:headers]
            )
          end
        end

        def assert_response_matches_metadata(metadata)
          ResponseValidator.new.validate!(metadata, response)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
open_api-rswag-specs-0.1.0 lib/open_api/rswag/specs/example_helpers.rb
open_api-rswag-specs-0.0.6 lib/open_api/rswag/specs/example_helpers.rb
open_api-rswag-specs-0.0.5 lib/open_api/rswag/specs/example_helpers.rb
open_api-rswag-specs-0.0.4 lib/open_api/rswag/specs/example_helpers.rb