pact_broker-client 1.38.1 → 1.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +38 -0
  4. data/Gemfile +4 -0
  5. data/README.md +18 -0
  6. data/bin/pact-broker +6 -0
  7. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +61 -140
  8. data/example/scripts/publish-pact.sh +1 -1
  9. data/lib/pact_broker/client/base_client.rb +1 -1
  10. data/lib/pact_broker/client/can_i_deploy.rb +20 -3
  11. data/lib/pact_broker/client/cli/broker.rb +35 -10
  12. data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -0
  13. data/lib/pact_broker/client/cli/version_selector_options_parser.rb +4 -0
  14. data/lib/pact_broker/client/colorize_notices.rb +31 -0
  15. data/lib/pact_broker/client/hal/entity.rb +16 -0
  16. data/lib/pact_broker/client/hal/http_client.rb +37 -1
  17. data/lib/pact_broker/client/hal/link.rb +12 -0
  18. data/lib/pact_broker/client/hal/links.rb +15 -0
  19. data/lib/pact_broker/client/hal_client_methods.rb +8 -0
  20. data/lib/pact_broker/client/matrix.rb +4 -0
  21. data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +15 -0
  22. data/lib/pact_broker/client/matrix/resource.rb +26 -1
  23. data/lib/pact_broker/client/matrix/text_formatter.rb +11 -8
  24. data/lib/pact_broker/client/pacts.rb +0 -1
  25. data/lib/pact_broker/client/publish_pacts.rb +94 -128
  26. data/lib/pact_broker/client/publish_pacts_the_old_way.rb +194 -0
  27. data/lib/pact_broker/client/tasks/publication_task.rb +3 -3
  28. data/lib/pact_broker/client/version.rb +1 -1
  29. data/lib/pact_broker/client/versions/record_deployment.rb +6 -6
  30. data/lib/pact_broker/client/versions/record_undeployment.rb +45 -68
  31. data/pact-broker-client.gemspec +1 -0
  32. data/script/approve-all.sh +6 -0
  33. data/script/publish-pact.sh +36 -5
  34. data/script/record-deployment.sh +1 -3
  35. data/script/record-undeployment.sh +4 -0
  36. data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
  37. data/spec/fixtures/foo-bar.json +31 -0
  38. data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +47 -5
  39. data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +3 -3
  40. data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +36 -7
  41. data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +21 -0
  42. data/spec/lib/pact_broker/client/hal/http_client_spec.rb +64 -7
  43. data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +3 -0
  44. data/spec/lib/pact_broker/client/{publish_pacts_spec.rb → publish_pacts_the_old_way_spec.rb} +10 -9
  45. data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +18 -12
  46. data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +5 -5
  47. data/spec/pacts/pact_broker_client-pact_broker.json +50 -124
  48. data/spec/service_providers/pact_broker_client_create_version_spec.rb +4 -4
  49. data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +98 -0
  50. data/spec/service_providers/publish_pacts_spec.rb +116 -0
  51. data/spec/service_providers/record_deployment_spec.rb +6 -7
  52. data/spec/spec_helper.rb +2 -1
  53. data/spec/support/approvals.rb +26 -0
  54. data/spec/support/shared_context.rb +6 -2
  55. metadata +41 -5
@@ -6,11 +6,14 @@ module PactBroker::Client::CLI
6
6
  describe Broker do
7
7
  describe ".broker" do
8
8
  before do
9
- allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(true)
9
+ allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(result)
10
10
  allow(PactBroker::Client::Git).to receive(:branch).and_return("bar")
11
11
  subject.options = OpenStruct.new(minimum_valid_options)
12
+ allow($stdout).to receive(:puts)
12
13
  end
13
14
 
15
+ let(:success) { true }
16
+ let(:result) { instance_double(PactBroker::Client::CommandResult, success: success, message: "message")}
14
17
  let(:file_list) { ["spec/support/cli_test_pacts/foo.json"] }
15
18
  let(:minimum_valid_options) do
16
19
  {
@@ -28,7 +31,8 @@ module PactBroker::Client::CLI
28
31
  "http://pact-broker",
29
32
  ["spec/support/cli_test_pacts/foo.json"],
30
33
  { number: "1.2.3", tags: [], version_required: false },
31
- { }
34
+ {},
35
+ {}
32
36
  )
33
37
  invoke_broker
34
38
  end
@@ -42,6 +46,7 @@ module PactBroker::Client::CLI
42
46
  anything,
43
47
  ["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
44
48
  anything,
49
+ anything,
45
50
  anything
46
51
  )
47
52
  invoke_broker
@@ -56,6 +61,7 @@ module PactBroker::Client::CLI
56
61
  anything,
57
62
  ["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
58
63
  anything,
64
+ anything,
59
65
  anything
60
66
  )
61
67
  invoke_broker
@@ -70,12 +76,29 @@ module PactBroker::Client::CLI
70
76
  anything,
71
77
  ["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
72
78
  anything,
79
+ anything,
73
80
  anything
74
81
  )
75
82
  invoke_broker
76
83
  end
77
84
  end
78
85
 
86
+ context "with an invalid argument specified that gets interpreted as a path" do
87
+ let(:file_list) { ['--wrong'] }
88
+
89
+ it "raises a more helpful error" do
90
+ expect{ invoke_broker }.to raise_error(Thor::Error, 'ERROR: pact-broker publish was called with invalid arguments ["--wrong"]')
91
+ end
92
+ end
93
+
94
+ context "when a specified file does not exist" do
95
+ let(:file_list) { ['no-existy'] }
96
+
97
+ it "raises a more helpful error" do
98
+ expect{ invoke_broker }.to raise_error(Thor::Error, /Specified pact file 'no-existy' does not exist/)
99
+ end
100
+ end
101
+
79
102
  context "with a tag" do
80
103
  before do
81
104
  subject.options = OpenStruct.new(minimum_valid_options.merge(tag: ['foo']))
@@ -86,6 +109,7 @@ module PactBroker::Client::CLI
86
109
  anything,
87
110
  anything,
88
111
  hash_including(tags: ['foo']),
112
+ anything,
89
113
  anything
90
114
  )
91
115
  invoke_broker
@@ -109,6 +133,7 @@ module PactBroker::Client::CLI
109
133
  anything,
110
134
  anything,
111
135
  hash_including(tags: ['foo', 'bar']),
136
+ anything,
112
137
  anything
113
138
  )
114
139
  invoke_broker
@@ -127,6 +152,7 @@ module PactBroker::Client::CLI
127
152
  anything,
128
153
  anything,
129
154
  hash_including(branch: "main", version_required: true),
155
+ anything,
130
156
  anything
131
157
  )
132
158
  invoke_broker
@@ -151,6 +177,7 @@ module PactBroker::Client::CLI
151
177
  anything,
152
178
  anything,
153
179
  hash_including(branch: "bar", version_required: false),
180
+ anything,
154
181
  anything
155
182
  )
156
183
  invoke_broker
@@ -176,6 +203,7 @@ module PactBroker::Client::CLI
176
203
  anything,
177
204
  anything,
178
205
  hash_including(branch: "bar", version_required: true),
206
+ anything,
179
207
  anything
180
208
  )
181
209
  invoke_broker
@@ -193,6 +221,7 @@ module PactBroker::Client::CLI
193
221
  anything,
194
222
  anything,
195
223
  hash_including(branch: "specified-branch", version_required: true),
224
+ anything,
196
225
  anything
197
226
  )
198
227
  invoke_broker
@@ -212,6 +241,7 @@ module PactBroker::Client::CLI
212
241
  anything,
213
242
  anything,
214
243
  hash_including(build_url: "http://ci"),
244
+ anything,
215
245
  anything
216
246
  )
217
247
  invoke_broker
@@ -230,6 +260,7 @@ module PactBroker::Client::CLI
230
260
  anything,
231
261
  anything,
232
262
  anything,
263
+ anything,
233
264
  hash_including(basic_auth: { username: 'foo', password: 'bar' })
234
265
  )
235
266
  invoke_broker
@@ -267,12 +298,10 @@ module PactBroker::Client::CLI
267
298
  end
268
299
 
269
300
  context "when the publish command is not successful" do
270
- before do
271
- allow(PactBroker::Client::PublishPacts).to receive(:call).and_return(false)
272
- end
301
+ let(:success) { false }
273
302
 
274
- it "raises a PactPublicationError" do
275
- expect { invoke_broker }.to raise_error PactPublicationError
303
+ it "raises a SystemExit" do
304
+ expect { invoke_broker }.to raise_error SystemExit
276
305
  end
277
306
  end
278
307
  end
@@ -48,6 +48,27 @@ module PactBroker
48
48
  ],[
49
49
  ["--pacticipant", "Foo=Bar", "--version", "1.2.3"],
50
50
  [{ pacticipant: "Foo=Bar", version: "1.2.3" } ]
51
+ ],[
52
+ ["--ignore", "Foo", "--version", "1.2.3"],
53
+ [{ pacticipant: "Foo", version: "1.2.3", ignore: true }]
54
+ ],[
55
+ ["--ignore", "Foo", "--ignore", "Bar", "--version", "1.2.3"],
56
+ [{ pacticipant: "Foo", ignore: true }, { pacticipant: "Bar", version: "1.2.3", ignore: true }]
57
+ ],[
58
+ ["--ignore", "Foo", "--pacticipant", "Bar", "--version", "1.2.3"],
59
+ [{ pacticipant: "Foo", ignore: true }, { pacticipant: "Bar", version: "1.2.3" }]
60
+ ],[
61
+ ["--pacticipant", "Foo", "--version", "1", "--version", "2"],
62
+ [{ pacticipant: "Foo", version: "2" }]
63
+ ],[
64
+ ["--pacticipant", "Foo", "--version", "2", "--latest"],
65
+ [{ pacticipant: "Foo", version: "2", latest: true }]
66
+ ],[
67
+ ["--pacticipant", "Foo", "--version", "2", "--latest", "--latest"],
68
+ [{ pacticipant: "Foo", version: "2", latest: true }]
69
+ ],[
70
+ ["--version", "2"],
71
+ [{ pacticipant: nil, version: "2" }]
51
72
  ]
52
73
  ]
53
74
 
@@ -3,13 +3,13 @@ require 'pact_broker/client/hal/http_client'
3
3
  module PactBroker::Client
4
4
  module Hal
5
5
  describe HttpClient do
6
- before do
7
- allow(Retry).to receive(:until_truthy_or_max_times) { |&block| block.call }
8
- end
9
-
10
6
  subject { HttpClient.new(username: 'foo', password: 'bar') }
11
7
 
12
8
  describe "get" do
9
+ before do
10
+ allow(subject).to receive(:until_truthy_or_max_times) { |&block| block.call }
11
+ end
12
+
13
13
  let!(:request) do
14
14
  stub_request(:get, "http://example.org/").
15
15
  with( headers: {
@@ -41,18 +41,22 @@ module PactBroker::Client
41
41
  end
42
42
  end
43
43
 
44
-
45
44
  it "retries on failure" do
46
- expect(Retry).to receive(:until_truthy_or_max_times)
45
+ expect(subject).to receive(:until_truthy_or_max_times)
47
46
  do_get
48
47
  end
49
48
 
50
49
  it "returns a response" do
51
50
  expect(do_get.body).to eq({"some" => "json"})
52
51
  end
52
+
53
53
  end
54
54
 
55
55
  describe "post" do
56
+ before do
57
+ allow(subject).to receive(:until_truthy_or_max_times) { |&block| block.call }
58
+ end
59
+
56
60
  let!(:request) do
57
61
  stub_request(:post, "http://example.org/").
58
62
  with( headers: {
@@ -75,7 +79,7 @@ module PactBroker::Client
75
79
  end
76
80
 
77
81
  it "calls Retry.until_truthy_or_max_times" do
78
- expect(Retry).to receive(:until_truthy_or_max_times)
82
+ expect(subject).to receive(:until_truthy_or_max_times)
79
83
  do_post
80
84
  end
81
85
 
@@ -100,6 +104,59 @@ module PactBroker::Client
100
104
  end
101
105
  end
102
106
  end
107
+
108
+ describe "integration test" do
109
+ before do
110
+ allow(subject).to receive(:sleep)
111
+ end
112
+
113
+ let(:do_get) { subject.get('http://example.org') }
114
+
115
+ context "with a 50x error is returned less than the max number of tries" do
116
+ let!(:request) do
117
+ stub_request(:get, "http://example.org").
118
+ to_return({ status: 500 }, { status: 502 }, { status: 503 }, { status: 200 })
119
+ end
120
+
121
+ it "retries" do
122
+ expect(do_get.status).to eq 200
123
+ end
124
+ end
125
+
126
+ context "with a 50x error is returned more than the max number of tries" do
127
+ let!(:request) do
128
+ stub_request(:get, "http://example.org").
129
+ to_return({ status: 500 }, { status: 501 }, { status: 502 }, { status: 503 }, { status: 504 })
130
+ end
131
+
132
+ it "retries and returns the last 50x response" do
133
+ expect(do_get.status).to eq 504
134
+ end
135
+ end
136
+
137
+ context "when exceptions are raised" do
138
+ before do
139
+ allow($stderr).to receive(:puts)
140
+ end
141
+
142
+ let!(:request) do
143
+ stub_request(:get, "http://example.org")
144
+ .to_raise(Errno::ECONNREFUSED)
145
+ end
146
+
147
+ it "logs the error" do
148
+ expect($stderr).to receive(:puts).with(/Errno::ECONNREFUSED/)
149
+ begin
150
+ do_get
151
+ rescue Errno::ECONNREFUSED
152
+ end
153
+ end
154
+
155
+ it "retries and raises the last exception" do
156
+ expect { do_get }.to raise_error(Errno::ECONNREFUSED)
157
+ end
158
+ end
159
+ end
103
160
  end
104
161
  end
105
162
  end
@@ -5,6 +5,9 @@ module PactBroker
5
5
  module Pacticipants2
6
6
  describe Create do
7
7
  describe ".call" do
8
+ before do
9
+ allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
10
+ end
8
11
  let(:pact_broker_client_options) { {} }
9
12
  let(:broker_base_url) { "http://url" }
10
13
  let(:params) { { name: 'Foo' } }
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
  require 'fakefs/safe'
3
- require 'pact_broker/client/publish_pacts'
3
+ require 'pact_broker/client/publish_pacts_the_old_way'
4
4
  require 'json'
5
5
 
6
6
  module PactBroker
7
7
  module Client
8
- describe PublishPacts do
8
+ describe PublishPactsTheOldWay do
9
9
 
10
10
  # The amount of stubbing that we have to do here indicates this class is doing
11
11
  # TOO MUCH and needs to be split up!
@@ -23,7 +23,7 @@ module PactBroker
23
23
  File.open("spec/pacts/consumer-provider.json", "w") { |file| file << pact_hash.to_json }
24
24
  File.open("spec/pacts/consumer-provider-2.json", "w") { |file| file << pact_hash.to_json }
25
25
  File.open("spec/pacts/foo-bar.json", "w") { |file| file << pact_hash_2.to_json }
26
- allow_any_instance_of(PublishPacts).to receive(:create_index_entry_point).and_return(index_entry_point)
26
+ allow_any_instance_of(PublishPactsTheOldWay).to receive(:create_index_entry_point).and_return(index_entry_point)
27
27
  end
28
28
 
29
29
  after do
@@ -63,8 +63,9 @@ module PactBroker
63
63
  let(:index_entry_point) { instance_double("PactBroker::Client::Hal::EntryPoint", :get! => index_resource )}
64
64
  let(:index_resource) { instance_double("PactBroker::Client::Hal::Entity", can?: can_create_version ) }
65
65
  let(:can_create_version) { false }
66
+ let(:options) { {} }
66
67
 
67
- subject { PublishPacts.new(pact_broker_base_url, pact_file_paths, consumer_version_params, pact_broker_client_options) }
68
+ subject { PublishPactsTheOldWay.new(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options) }
68
69
 
69
70
  describe "call" do
70
71
  it "creates a PactBroker Client" do
@@ -85,7 +86,7 @@ module PactBroker
85
86
  end
86
87
 
87
88
  it "returns true" do
88
- expect(subject.call).to be true
89
+ expect(subject.call.success).to eq true
89
90
  end
90
91
  end
91
92
 
@@ -140,7 +141,7 @@ module PactBroker
140
141
  end
141
142
 
142
143
  it "returns false" do
143
- expect(subject.call).to be false
144
+ expect(subject.call.success).to be false
144
145
  end
145
146
  end
146
147
 
@@ -212,7 +213,7 @@ module PactBroker
212
213
  end
213
214
 
214
215
  it "returns false" do
215
- expect(subject.call).to eq false
216
+ expect(subject.call.success).to eq false
216
217
  end
217
218
  end
218
219
  end
@@ -230,7 +231,7 @@ module PactBroker
230
231
  end
231
232
 
232
233
  it "returns false" do
233
- expect(subject.call).to eq false
234
+ expect(subject.call.success).to eq false
234
235
  end
235
236
  end
236
237
 
@@ -255,7 +256,7 @@ module PactBroker
255
256
  end
256
257
 
257
258
  it "returns true" do
258
- expect(subject.call).to eq true
259
+ expect(subject.call.success).to eq true
259
260
  end
260
261
  end
261
262
 
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'pact_broker/client/tasks/publication_task'
3
3
  require 'pact_broker/client/publish_pacts'
4
+ require 'pact_broker/client/command_result'
4
5
 
5
6
  module PactBroker::Client
6
7
  describe PublicationTask do
@@ -9,13 +10,16 @@ module PactBroker::Client
9
10
  @consumer_version = "1.2.3"
10
11
  end
11
12
 
12
- let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call: true)}
13
+ let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call: result)}
13
14
  let(:pact_file_list) { ['spec/pact/consumer-provider.json'] }
15
+ let(:success) { true }
16
+ let(:result) { instance_double(PactBroker::Client::CommandResult, success: success, message: "message")}
14
17
 
15
18
  before do
16
19
  allow(PactBroker::Client::PublishPacts).to receive(:new).and_return(publish_pacts)
17
20
  allow(FileList).to receive(:[]).with(pattern).and_return(pact_file_list)
18
21
  allow(PactBroker::Client::Git).to receive(:branch).and_return('foo')
22
+ allow($stdout).to receive(:puts)
19
23
  end
20
24
 
21
25
  let(:pattern) { "spec/pacts/*.json" }
@@ -29,15 +33,16 @@ module PactBroker::Client
29
33
 
30
34
  context "when pacts are succesfully published" do
31
35
  it "invokes PublishPacts with the default values" do
32
- expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}).and_return(publish_pacts)
33
- expect(publish_pacts).to receive(:call).and_return(true)
36
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}, {}).and_return(publish_pacts)
37
+ expect(publish_pacts).to receive(:call).and_return(result)
34
38
  Rake::Task['pact:publish'].execute
35
39
  end
36
40
  end
37
41
 
38
42
  context "when a pact fails to be published" do
43
+ let(:success) { false }
44
+
39
45
  it "raises an error" do
40
- expect(publish_pacts).to receive(:call).and_return(false)
41
46
  expect { Rake::Task['pact:publish'].execute }.to raise_error("One or more pacts failed to be published")
42
47
  end
43
48
  end
@@ -52,8 +57,8 @@ module PactBroker::Client
52
57
  end
53
58
 
54
59
  it "invokes PublishPacts with the write method set" do
55
- expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {write: :merge}).and_return(publish_pacts)
56
- expect(publish_pacts).to receive(:call).and_return(true)
60
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {}, {write: :merge}).and_return(publish_pacts)
61
+ expect(publish_pacts).to receive(:call).and_return(result)
57
62
  Rake::Task['pact:publish:merge'].execute
58
63
  end
59
64
  end
@@ -74,7 +79,7 @@ module PactBroker::Client
74
79
  end
75
80
 
76
81
  it "invokes PublishPacts with the git branch name as a tag" do
77
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything).and_return(publish_pacts)
82
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything, anything).and_return(publish_pacts)
78
83
  Rake::Task['pact:publish:git_branch'].execute
79
84
  end
80
85
  end
@@ -93,7 +98,7 @@ module PactBroker::Client
93
98
  end
94
99
 
95
100
  it "invokes PublishPacts with the branch name" do
96
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
101
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything, anything).and_return(publish_pacts)
97
102
  Rake::Task['pact:publish:git_branch_auto_detect_true'].execute
98
103
  end
99
104
  end
@@ -113,7 +118,7 @@ module PactBroker::Client
113
118
  end
114
119
 
115
120
  it "invokes PublishPacts with the specified branch name" do
116
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything).and_return(publish_pacts)
121
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything, anything).and_return(publish_pacts)
117
122
  Rake::Task['pact:publish:git_branch_auto_detect_true_with_branch'].execute
118
123
  end
119
124
  end
@@ -132,7 +137,7 @@ module PactBroker::Client
132
137
  end
133
138
 
134
139
  it "invokes PublishPacts without the branch name" do
135
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything).and_return(publish_pacts)
140
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything, anything).and_return(publish_pacts)
136
141
  Rake::Task['pact:publish:git_branch_auto_detect_false'].execute
137
142
  end
138
143
  end
@@ -150,7 +155,7 @@ module PactBroker::Client
150
155
  end
151
156
 
152
157
  it "invokes PublishPacts with the branch name" do
153
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
158
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"),anything, anything).and_return(publish_pacts)
154
159
  Rake::Task['pact:publish:git_branch_auto_detect_default'].execute
155
160
  end
156
161
  end
@@ -180,9 +185,10 @@ module PactBroker::Client
180
185
  @pact_broker_base_url,
181
186
  pact_file_list,
182
187
  { number: "1.2.3", tags: [@tag], branch: "foo", version_required: false},
188
+ {},
183
189
  { basic_auth: @pact_broker_basic_auth, token: @pact_broker_token }
184
190
  )
185
- expect(publish_pacts).to receive(:call).and_return(true)
191
+ expect(publish_pacts).to receive(:call).and_return(result)
186
192
  Rake::Task['pact:publish:custom'].execute
187
193
  end
188
194
  end