Sha256: f51c5836a1ef7072f5a089ed2c540e1429524fe90a517f67583602343677da49
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
# TODO: Move Resource out of formatter dir require 'rspec_api_docs/formatter/resource' require 'rspec_api_docs/after/type_checker' module RspecApiDocs UndocumentedParameter = Class.new(BaseError) class After Hook = -> (example) do metadata = example.metadata[METADATA_NAMESPACE] return unless metadata metadata[:requests] ||= [] metadata[:requests] << [last_request, last_response] return unless RspecApiDocs.configuration.validate_params metadata[:requests].each do |request, response| request.params.each do |key, value| parameter = RspecApiDocs::Resource::Example.new(example).parameters .select { |parameter| parameter.name == key.to_sym }.first if parameter After::TypeChecker.call(type: parameter.type, value: value) else raise UndocumentedParameter, "undocumented parameter included in request #{key.inspect}" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-api-docs-0.9.0 | lib/rspec_api_docs/after.rb |