24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/pact/provider/rspec.rb', line 24
def honour_pactfile pact_source, pact_json, options
pact_uri = pact_source.uri
Pact.configuration.output_stream.puts "INFO: Reading pact at #{pact_uri}"
consumer_contract = Pact::ConsumerContract.from_json(pact_json)
suffix = pact_uri.metadata[:pending] ? " [PENDING]": ""
example_group_description = "Verifying a pact between #{consumer_contract.consumer.name} and #{consumer_contract.provider.name}#{suffix}"
example_group_metadata = { pactfile_uri: pact_uri, pact_criteria: options[:criteria] }
::RSpec.describe example_group_description, example_group_metadata do
honour_consumer_contract consumer_contract, options.merge(
pact_json: pact_json,
pact_uri: pact_uri,
pact_source: pact_source,
consumer_contract: consumer_contract,
criteria: options[:criteria]
)
end
end
|