Skip to content

Commit f2f9626

Browse files
committed
feat: allow pact dir to be configured
1 parent 24ba75b commit f2f9626

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/pact/message/consumer/configuration/message_builder.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def configure_consumer_contract_builder
4040

4141
def create_consumer_contract_builder
4242
consumer_contract_builder_fields = {
43-
:consumer_name => consumer_name,
44-
:provider_name => provider_name,
43+
consumer_name: consumer_name,
44+
provider_name: provider_name,
45+
pact_specification_version: pact_specification_version,
46+
pact_dir: Pact.configuration.pact_dir
4547
}
46-
# :pactfile_write_mode => Pact.configuration.pactfile_write_mode,
47-
# :pact_dir => Pact.configuration.pact_dir
4848
Pact::Message::Consumer::ConsumerContractBuilder.new consumer_contract_builder_fields
4949
end
5050

lib/pact/message/consumer/consumer_contract_builder.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ def initialize(attributes)
1111
@interaction_builder = nil
1212
@consumer_name = attributes[:consumer_name]
1313
@provider_name = attributes[:provider_name]
14+
@pact_specification_version = attributes[:pact_specification_version]
15+
@pact_dir = attributes[:pact_dir]
1416
@interactions = []
1517
@yielded_interaction = false
1618
end
@@ -68,12 +70,12 @@ def verify example_description
6870
end
6971

7072
def write_pact
71-
Pact::Message::Consumer::WritePact.call(interactions, "./spec/pacts", consumer_name, provider_name, "2.0.0", :overwrite)
73+
Pact::Message::Consumer::WritePact.call(interactions, pact_dir, consumer_name, provider_name, pact_specification_version, :overwrite)
7274
end
7375

7476
private
7577

76-
attr_accessor :consumer_name, :provider_name, :consumer_contract_details, :contents, :interactions
78+
attr_accessor :consumer_name, :provider_name, :consumer_contract_details, :contents, :interactions, :pact_specification_version, :pact_dir
7779

7880
def interaction_builder?
7981
!!@interaction_builder

0 commit comments

Comments
 (0)