@@ -49,9 +49,10 @@ module Pact::Consumer::Configuration
49
49
pact_specification_version '1'
50
50
end
51
51
}
52
+ let ( :opts ) { { pact_specification_version : '1' , find_available_port : false } }
52
53
it "registers the app with the AppManager" do
53
54
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 ) .
55
56
and_return ( port_number )
56
57
subject
57
58
end
@@ -60,10 +61,10 @@ module Pact::Consumer::Configuration
60
61
context "without port specification" do
61
62
let ( :url ) { 'http://localhost' }
62
63
subject { MockService . build ( :mock_service , consumer_name , provider_name ) { } }
63
-
64
+ let ( :opts ) { { pact_specification_version : '2' , find_available_port : true } }
64
65
it "registers the app with the AppManager with find_available_port option" do
65
66
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 ) .
67
68
and_return ( port_number )
68
69
subject
69
70
end
@@ -72,10 +73,11 @@ module Pact::Consumer::Configuration
72
73
context "without port specification and old pact-mock_service" do
73
74
let ( :url ) { 'http://localhost' }
74
75
subject { MockService . build ( :mock_service , consumer_name , provider_name ) { } }
76
+ let ( :opts ) { { pact_specification_version : '2' , find_available_port : true } }
75
77
76
78
it "checks and raises an error" do
77
79
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 ) .
79
81
and_return ( nil )
80
82
expect { subject } . to raise_error ( /pact-mock_service.+does not support/ )
81
83
end
0 commit comments