From b585092a242b6d0cf246be15821c99f56f4c2e83 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 23 Jul 2018 09:47:44 +1000 Subject: [PATCH] fix: pass the pact specification version from the control server to the mock server --- lib/pact/mock_service/control_server/run.rb | 3 ++- spec/integration/control_server_cli_spec.rb | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/pact/mock_service/control_server/run.rb b/lib/pact/mock_service/control_server/run.rb index 7c3e15b..1184408 100644 --- a/lib/pact/mock_service/control_server/run.rb +++ b/lib/pact/mock_service/control_server/run.rb @@ -54,7 +54,8 @@ def control_server_options pact_dir: options[:pact_dir] || ".", unique_pact_file_names: options[:unique_pact_file_names], cors_enabled: options[:cors] || false, - ssl: options[:ssl] + ssl: options[:ssl], + pact_specification_version: options[:pact_specification_version] } end diff --git a/spec/integration/control_server_cli_spec.rb b/spec/integration/control_server_cli_spec.rb index 3ccb093..d38078b 100644 --- a/spec/integration/control_server_cli_spec.rb +++ b/spec/integration/control_server_cli_spec.rb @@ -22,7 +22,7 @@ def mock_service_headers before :all do clear_dirs - @pid = start_control 1234 + @pid = start_control 1234, "--pact-specification-version 3" end it "starts up and responds with mocked responses" do @@ -49,6 +49,10 @@ def mock_service_headers expect(File.exist?('tmp/pacts/consumer-provider.json')).to be true end + it "writes the pacts with the specified in pact specification version" do + expect(JSON.parse(File.read('tmp/pacts/consumer-provider.json'))['metadata']['pactSpecification']['version']).to eq '3.0.0' + end + after :all do kill_server @pid end