diff --git a/lib/pact/provider/rspec/pact_broker_formatter.rb b/lib/pact/provider/rspec/pact_broker_formatter.rb index 218cce29..1c234776 100644 --- a/lib/pact/provider/rspec/pact_broker_formatter.rb +++ b/lib/pact/provider/rspec/pact_broker_formatter.rb @@ -27,17 +27,9 @@ def dump_summary(summary) end def stop(notification) - @output_hash[:examples] = notification.examples.map do |example| - format_example(example).tap do |hash| - e = example.exception - if e - hash[:exception] = { - class: e.class.name, - message: ::Term::ANSIColor.uncolor(e.message) - } - end - end - end + @output_hash[:tests] = notification + .examples + .map { |example| format_example(example) } end def seed(notification) @@ -53,14 +45,21 @@ def close(_notification) def format_example(example) { - exampleDescription: example.description, - exampleFullDescription: example.full_description, + testDescription: example.description, + testFullDescription: example.full_description, status: example.execution_result.status.to_s, interactionProviderState: example.metadata[:pact_interaction].provider_state, interactionDescription: example.metadata[:pact_interaction].description, pact_uri: example.metadata[:pact_uri], pact_interaction: example.metadata[:pact_interaction] - } + }.tap do |hash| + if example.exception + hash[:exception] = { + class: example.exception.class.name, + message: ::Term::ANSIColor.uncolor(example.exception.message) + } + end + end end end end diff --git a/lib/pact/provider/verification_results/create.rb b/lib/pact/provider/verification_results/create.rb index b0a61b47..0e531147 100644 --- a/lib/pact/provider/verification_results/create.rb +++ b/lib/pact/provider/verification_results/create.rb @@ -32,7 +32,7 @@ def publishable? end def examples_for_pact_uri - @examples_for_pact_uri ||= test_results_hash[:examples].select{ |e| e[:pact_uri] == pact_uri } + @examples_for_pact_uri ||= test_results_hash[:tests].select{ |e| e[:pact_uri] == pact_uri } end def count_failures_for_pact_uri @@ -52,9 +52,9 @@ def all_interactions_count def test_results_hash_for_pact_uri { - examples: examples_for_pact_uri.collect{ |e| clean_example(e) }, + tests: examples_for_pact_uri.collect{ |e| clean_example(e) }, summary: { - exampleCount: examples_for_pact_uri.size, + testCount: examples_for_pact_uri.size, failureCount: count_failures_for_pact_uri } } diff --git a/spec/integration/publish_verification_spec.rb b/spec/integration/publish_verification_spec.rb index 4546059c..0d3f9a4d 100644 --- a/spec/integration/publish_verification_spec.rb +++ b/spec/integration/publish_verification_spec.rb @@ -46,9 +46,9 @@ let(:test_results_hash) do { - examples: [ + tests: [ { - exampleDescription: '1', + testDescription: '1', status: 'passed', pact_uri: pact_uri } diff --git a/spec/lib/pact/provider/verification_results/create_spec.rb b/spec/lib/pact/provider/verification_results/create_spec.rb index c04efc60..c27cd194 100644 --- a/spec/lib/pact/provider/verification_results/create_spec.rb +++ b/spec/lib/pact/provider/verification_results/create_spec.rb @@ -34,7 +34,7 @@ module VerificationResults end let(:test_results_hash) do { - examples: [example_1, example_2] + tests: [example_1, example_2] } end let(:pact_hash_1) do @@ -51,8 +51,8 @@ module VerificationResults it "creates a VerificationResult with the relevant test results" do expected_test_results_hash = { - examples: [{ status: "passed" }], - summary: { exampleCount: 1, failureCount: 0} + tests: [{ status: "passed" }], + summary: { testCount: 1, failureCount: 0} } expect(VerificationResult).to receive(:new).with(anything, anything, anything, expected_test_results_hash) subject