Sha256: 566631a3ff40f1b534c2d7f9aa8e3e996aef5cb474da7bfabff4151be1ffd902

Contents?: true

Size: 813 Bytes

Versions: 8

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

require 'rspec/core'

RSpec.configuration.after(:each) do |example|
  if RSpec::OpenAPI.example_types.include?(example.metadata[:type]) && example.metadata[:openapi] != false
    path = RSpec::OpenAPI.path.yield_self { |p| p.is_a?(Proc) ? p.call(example) : p }
    record = RSpec::OpenAPI::RecordBuilder.build(self, example: example)
    RSpec::OpenAPI.path_records[path] << record if record
  end
end

RSpec.configuration.after(:suite) do
  result_recorder = RSpec::OpenAPI::ResultRecorder.new(RSpec::OpenAPI.path_records)
  result_recorder.record_results!
  if result_recorder.errors?
    error_message = result_recorder.error_message
    colorizer = RSpec::Core::Formatters::ConsoleCodes
    RSpec.configuration.reporter.message colorizer.wrap(error_message, :failure)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-openapi-0.14.0 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.13.0 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.12.0 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.11.0 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.10.0 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.9.0 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.8.1 lib/rspec/openapi/rspec_hooks.rb
rspec-openapi-0.8.0 lib/rspec/openapi/rspec_hooks.rb