module Rswag::Specs::ExampleHelpers

Public Instance Methods

assert_response_matches_metadata(metadata) click to toggle source
# File lib/rswag/specs/example_helpers.rb, line 29
def assert_response_matches_metadata(metadata)
  ResponseValidator.new.validate!(metadata, response)
end
submit_request(metadata) click to toggle source
# File lib/rswag/specs/example_helpers.rb, line 9
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