@@ -49,9 +49,10 @@ module Pact::Consumer::Configuration
4949 pact_specification_version '1'
5050 end
5151 }
52+ let ( :opts ) { { pact_specification_version : '1' , find_available_port : false } }
5253 it "registers the app with the AppManager" do
5354 expect ( Pact ::MockService ::AppManager . instance ) . to receive ( :register_mock_service_for ) .
54- with ( provider_name , url , pact_specification_version : '1' , find_available_port : false ) .
55+ with ( provider_name , url , opts ) .
5556 and_return ( port_number )
5657 subject
5758 end
@@ -60,10 +61,10 @@ module Pact::Consumer::Configuration
6061 context "without port specification" do
6162 let ( :url ) { 'http://localhost' }
6263 subject { MockService . build ( :mock_service , consumer_name , provider_name ) { } }
63-
64+ let ( :opts ) { { pact_specification_version : '2' , find_available_port : true } }
6465 it "registers the app with the AppManager with find_available_port option" do
6566 expect ( Pact ::MockService ::AppManager . instance ) . to receive ( :register_mock_service_for ) .
66- with ( provider_name , url , pact_specification_version : '2' , find_available_port : true ) .
67+ with ( provider_name , url , opts ) .
6768 and_return ( port_number )
6869 subject
6970 end
@@ -72,10 +73,11 @@ module Pact::Consumer::Configuration
7273 context "without port specification and old pact-mock_service" do
7374 let ( :url ) { 'http://localhost' }
7475 subject { MockService . build ( :mock_service , consumer_name , provider_name ) { } }
76+ let ( :opts ) { { pact_specification_version : '2' , find_available_port : true } }
7577
7678 it "checks and raises an error" do
7779 expect ( Pact ::MockService ::AppManager . instance ) . to receive ( :register_mock_service_for ) .
78- with ( provider_name , url , pact_specification_version : '2' , find_available_port : true ) .
80+ with ( provider_name , url , opts ) .
7981 and_return ( nil )
8082 expect { subject } . to raise_error ( /pact-mock_service.+does not support/ )
8183 end
0 commit comments