Skip to content

Commit

Permalink
fix: ConsumerContractBuilder exposing incorrect field
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc committed Feb 7, 2019
1 parent 094e0fe commit c805c3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pact/consumer/consumer_contract_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {}
Expand Down
11 changes: 11 additions & 0 deletions spec/lib/pact/consumer/consumer_contract_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c805c3e

Please sign in to comment.