lib/rspec/openapi/hooks.rb in rspec-openapi-0.4.0 vs lib/rspec/openapi/hooks.rb in rspec-openapi-0.4.1
- old
+ new
@@ -7,11 +7,11 @@
records = []
records_errors = []
RSpec.configuration.after(:each) do |example|
- if example.metadata[:type] == :request && example.metadata[:openapi] != false
+ if RSpec::OpenAPI.example_types.include?(example.metadata[:type]) && example.metadata[:openapi] != false
record = RSpec::OpenAPI::RecordBuilder.build(self, example: example)
records << record if record
end
end
@@ -29,10 +29,10 @@
end
end
if records_errors.any?
error_message = <<~EOS
RSpec::OpenAPI got errors building #{records_errors.size} requests
-
+
#{records_errors.map {|e, record| "#{e.inspect}: #{record.inspect}" }.join("\n")}
EOS
colorizer = ::RSpec::Core::Formatters::ConsoleCodes
RSpec.configuration.reporter.message colorizer.wrap(error_message, :failure)
end