From c805c3e042ee903ffab5e65b9fe84bed99d88ec3 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Wed, 6 Feb 2019 19:00:18 -0500 Subject: [PATCH] fix: ConsumerContractBuilder exposing incorrect field --- lib/pact/consumer/consumer_contract_builder.rb | 4 ++-- .../pact/consumer/consumer_contract_builder_spec.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/pact/consumer/consumer_contract_builder.rb b/lib/pact/consumer/consumer_contract_builder.rb index c186b7ce..63fe7bfe 100644 --- a/lib/pact/consumer/consumer_contract_builder.rb +++ b/lib/pact/consumer/consumer_contract_builder.rb @@ -15,7 +15,7 @@ class ConsumerContractBuilder def initialize(attributes) @interaction_builder = nil - @consumer_contract_details = { + @consumer_contract = { consumer: {name: attributes[:consumer_name]}, provider: {name: attributes[:provider_name]}, pactfile_write_mode: attributes[:pactfile_write_mode].to_s, @@ -42,7 +42,7 @@ def log msg end def write_pact - mock_service_client.write_pact @consumer_contract_details + mock_service_client.write_pact @consumer_contract end def wait_for_interactions options = {} diff --git a/spec/lib/pact/consumer/consumer_contract_builder_spec.rb b/spec/lib/pact/consumer/consumer_contract_builder_spec.rb index 62e867b8..00c5db37 100644 --- a/spec/lib/pact/consumer/consumer_contract_builder_spec.rb +++ b/spec/lib/pact/consumer/consumer_contract_builder_spec.rb @@ -62,6 +62,17 @@ module Consumer end end + describe "#consumer_contract" do + it "returns the consumer contract" do + expect(subject.consumer_contract).to eq( + consumer: { name: consumer_name }, + provider: { name: provider_name }, + pactfile_write_mode: 'overwrite', + pact_dir: pact_dir + ) + end + end + describe "#mock_service_base_url" do subject do