Sha256: 41b217ecb1d3ac584693262db3546c95994ee2d396365381123417673492782f

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

require 'rswag3/specs/request_factory'
require 'rswag3/specs/response_validator'

module Rswag3
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rswag3-specs-0.0.2 lib/rswag3/specs/example_helpers.rb
rswag3-specs-0.0.1 lib/rswag3/specs/example_helpers.rb