More useful error messages in rswag-specs

This commit is contained in:
richie
2016-10-13 16:56:44 -07:00
parent f1850bc6d0
commit b81b2927be
10 changed files with 187 additions and 132 deletions

View File

@@ -6,7 +6,7 @@ module Rswag
module ExampleHelpers
def submit_request(api_metadata)
factory = RequestFactory.new(api_metadata, global_metadata(api_metadata[:swagger_doc]))
factory = RequestFactory.new(api_metadata, config.get_swagger_doc(api_metadata[:swagger_doc]))
if RAILS_VERSION < 5
send(
@@ -28,15 +28,14 @@ module Rswag
end
def assert_response_matches_metadata(api_metadata)
validator = ResponseValidator.new(api_metadata, global_metadata(api_metadata[:swagger_doc]))
validator = ResponseValidator.new(api_metadata, config.get_swagger_doc(api_metadata[:swagger_doc]))
validator.validate!(response)
end
private
def global_metadata(swagger_doc)
swagger_docs = ::RSpec.configuration.swagger_docs
swagger_doc.nil? ? swagger_docs.values.first : swagger_docs[swagger_doc]
def config
::Rswag::Specs.config
end
end
end