@@ -6,6 +6,7 @@ module Configuration
6
6
describe PactVerificationFromBroker do
7
7
describe 'build' do
8
8
let ( :provider_name ) { 'provider-name' }
9
+ let ( :provider_version_branch ) { 'main' }
9
10
let ( :provider_version_tags ) { [ 'master' ] }
10
11
let ( :base_url ) { "http://broker.org" }
11
12
let ( :since ) { "2020-01-01" }
@@ -25,7 +26,7 @@ module Configuration
25
26
26
27
context "with valid values" do
27
28
subject do
28
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
29
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
29
30
pact_broker_base_url base_url , basic_auth_options
30
31
consumer_version_tags tags
31
32
enable_pending true
@@ -43,6 +44,7 @@ module Configuration
43
44
expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with (
44
45
provider_name ,
45
46
consumer_version_selectors ,
47
+ provider_version_branch ,
46
48
provider_version_tags ,
47
49
base_url ,
48
50
basic_auth_opts ,
@@ -66,6 +68,7 @@ module Configuration
66
68
anything ,
67
69
anything ,
68
70
anything ,
71
+ anything ,
69
72
{
70
73
include_pending_status : true ,
71
74
include_wip_pacts_since : since . xmlschema
@@ -78,7 +81,7 @@ module Configuration
78
81
79
82
context "with a missing base url" do
80
83
subject do
81
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
84
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
82
85
83
86
end
84
87
end
@@ -90,27 +93,27 @@ module Configuration
90
93
91
94
context "with a non array object for consumer_version_tags" do
92
95
subject do
93
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
96
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
94
97
pact_broker_base_url base_url
95
98
consumer_version_tags "master"
96
99
end
97
100
end
98
101
99
102
it "coerces the value into an array" do
100
- expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ { tag : "master" , latest : true } ] , anything , anything , anything , anything )
103
+ expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ { tag : "master" , latest : true } ] , anything , anything , anything , anything , anything )
101
104
subject
102
105
end
103
106
end
104
107
105
108
context "when no consumer_version_tags are provided" do
106
109
subject do
107
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
110
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
108
111
pact_broker_base_url base_url
109
112
end
110
113
end
111
114
112
- it "creates an instance of FetchPacts with an emtpy array for the consumer_version_tags" do
113
- expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ ] , anything , anything , anything , anything )
115
+ it "creates an instance of FetchPacts with an empty array for the consumer_version_tags" do
116
+ expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ ] , anything , anything , anything , anything , anything )
114
117
subject
115
118
end
116
119
end
@@ -119,14 +122,14 @@ module Configuration
119
122
let ( :tags ) { [ { name : 'main' , all : true , fallback : 'fallback' } ] }
120
123
121
124
subject do
122
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
125
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
123
126
pact_broker_base_url base_url
124
127
consumer_version_tags tags
125
128
end
126
129
end
127
130
128
131
it "converts them to selectors" do
129
- expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ { tag : "main" , latest : false , fallbackTag : 'fallback' } ] , anything , anything , anything , anything )
132
+ expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ { tag : "main" , latest : false , fallbackTag : 'fallback' } ] , anything , anything , anything , anything , anything )
130
133
subject
131
134
end
132
135
end
@@ -135,7 +138,7 @@ module Configuration
135
138
let ( :tags ) { [ true ] }
136
139
137
140
subject do
138
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
141
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
139
142
pact_broker_base_url base_url
140
143
consumer_version_tags tags
141
144
end
@@ -150,27 +153,27 @@ module Configuration
150
153
let ( :tags ) { [ { tag : 'main' , latest : true , fallback_tag : 'fallback' } ] }
151
154
152
155
subject do
153
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
156
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
154
157
pact_broker_base_url base_url
155
158
consumer_version_selectors tags
156
159
end
157
160
end
158
161
159
162
it "converts the casing of the key names" do
160
- expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ { tag : "main" , latest : true , fallbackTag : 'fallback' } ] , anything , anything , anything , anything )
163
+ expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , [ { tag : "main" , latest : true , fallbackTag : 'fallback' } ] , anything , anything , anything , anything , anything )
161
164
subject
162
165
end
163
166
end
164
167
165
168
context "when no verbose flag is provided" do
166
169
subject do
167
- PactVerificationFromBroker . build ( provider_name , provider_version_tags ) do
170
+ PactVerificationFromBroker . build ( provider_name , provider_version_branch , provider_version_tags ) do
168
171
pact_broker_base_url base_url
169
172
end
170
173
end
171
174
172
175
it "creates an instance of FetchPactURIsForVerification with verbose: false" do
173
- expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , anything , anything , anything , hash_including ( verbose : false ) , anything )
176
+ expect ( Pact ::PactBroker ::FetchPactURIsForVerification ) . to receive ( :new ) . with ( anything , anything , anything , anything , anything , hash_including ( verbose : false ) , anything )
174
177
subject
175
178
end
176
179
end
0 commit comments