pact_broker-client 1.40.0 → 1.45.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +21 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +57 -0
  5. data/Gemfile +4 -0
  6. data/README.md +39 -22
  7. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +79 -280
  8. data/lib/pact_broker/client/backports.rb +9 -0
  9. data/lib/pact_broker/client/base_command.rb +98 -0
  10. data/lib/pact_broker/client/can_i_deploy.rb +57 -5
  11. data/lib/pact_broker/client/cli/broker.rb +23 -76
  12. data/lib/pact_broker/client/cli/custom_thor.rb +12 -0
  13. data/lib/pact_broker/client/cli/deployment_commands.rb +94 -0
  14. data/lib/pact_broker/client/cli/environment_commands.rb +70 -0
  15. data/lib/pact_broker/client/cli/pacticipant_commands.rb +53 -0
  16. data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -55
  17. data/lib/pact_broker/client/cli/version_selector_options_parser.rb +4 -0
  18. data/lib/pact_broker/client/colorize_notices.rb +31 -0
  19. data/lib/pact_broker/client/deployments.rb +4 -0
  20. data/lib/pact_broker/client/deployments/record_deployment.rb +38 -0
  21. data/lib/pact_broker/client/deployments/record_release.rb +99 -0
  22. data/lib/pact_broker/client/deployments/record_support_ended.rb +103 -0
  23. data/lib/pact_broker/client/deployments/record_undeployment.rb +127 -0
  24. data/lib/pact_broker/client/describe_text_formatter.rb +23 -0
  25. data/lib/pact_broker/client/environments.rb +6 -0
  26. data/lib/pact_broker/client/environments/create_environment.rb +31 -0
  27. data/lib/pact_broker/client/environments/delete_environment.rb +27 -0
  28. data/lib/pact_broker/client/environments/describe_environment.rb +26 -0
  29. data/lib/pact_broker/client/environments/environment_command.rb +66 -0
  30. data/lib/pact_broker/client/environments/list_environments.rb +30 -0
  31. data/lib/pact_broker/client/environments/text_formatter.rb +30 -0
  32. data/lib/pact_broker/client/environments/update_environment.rb +31 -0
  33. data/lib/pact_broker/client/generate_display_name.rb +27 -0
  34. data/lib/pact_broker/client/hal/entity.rb +31 -6
  35. data/lib/pact_broker/client/hal/http_client.rb +8 -2
  36. data/lib/pact_broker/client/hal/link.rb +8 -0
  37. data/lib/pact_broker/client/hal_client_methods.rb +1 -3
  38. data/lib/pact_broker/client/matrix.rb +4 -0
  39. data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +15 -0
  40. data/lib/pact_broker/client/matrix/resource.rb +26 -1
  41. data/lib/pact_broker/client/matrix/text_formatter.rb +28 -17
  42. data/lib/pact_broker/client/pacticipants.rb +6 -0
  43. data/lib/pact_broker/client/pacticipants/create.rb +24 -34
  44. data/lib/pact_broker/client/pacticipants/describe.rb +33 -0
  45. data/lib/pact_broker/client/pacticipants/list.rb +34 -0
  46. data/lib/pact_broker/client/pacticipants/text_formatter.rb +41 -0
  47. data/lib/pact_broker/client/publish_pacts.rb +6 -2
  48. data/lib/pact_broker/client/string_refinements.rb +56 -0
  49. data/lib/pact_broker/client/version.rb +1 -1
  50. data/lib/pact_broker/client/versions.rb +4 -1
  51. data/lib/pact_broker/client/versions/describe.rb +3 -1
  52. data/lib/pact_broker/client/versions/formatter.rb +3 -1
  53. data/lib/pact_broker/client/versions/json_formatter.rb +5 -3
  54. data/lib/pact_broker/client/versions/text_formatter.rb +3 -1
  55. data/pact-broker-client.gemspec +2 -0
  56. data/script/approve-all.sh +6 -0
  57. data/script/publish-pact.sh +12 -9
  58. data/script/record-deployments-and-releases.sh +18 -0
  59. data/spec/fixtures/approvals/can_i_deploy_failure_dry_run.approved.txt +7 -0
  60. data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
  61. data/spec/fixtures/approvals/can_i_deploy_success_dry_run.approved.txt +7 -0
  62. data/spec/fixtures/approvals/describe_environment.approved.txt +7 -0
  63. data/spec/fixtures/approvals/describe_pacticipant.approved.txt +2 -0
  64. data/spec/fixtures/approvals/list_environments.approved.txt +3 -0
  65. data/spec/integration/describe_environment_spec.rb +31 -0
  66. data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +109 -7
  67. data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +19 -6
  68. data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +1 -1
  69. data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +3 -3
  70. data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +21 -0
  71. data/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +204 -0
  72. data/spec/lib/pact_broker/client/deployments/record_support_ended_spec.rb +208 -0
  73. data/spec/lib/pact_broker/client/deployments/record_undeployment_spec.rb +219 -0
  74. data/spec/lib/pact_broker/client/environments/delete_environment_spec.rb +120 -0
  75. data/spec/lib/pact_broker/client/environments/describe_environment_spec.rb +89 -0
  76. data/spec/lib/pact_broker/client/environments/update_environment_spec.rb +167 -0
  77. data/spec/lib/pact_broker/client/generate_display_name_spec.rb +39 -0
  78. data/spec/lib/pact_broker/client/hal/entity_spec.rb +2 -2
  79. data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +2 -2
  80. data/spec/pacts/pact_broker_client-pact_broker.json +88 -287
  81. data/spec/service_providers/create_environment_spec.rb +78 -0
  82. data/spec/service_providers/list_environments_spec.rb +77 -0
  83. data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +98 -0
  84. data/spec/service_providers/pact_broker_client_register_repository_spec.rb +2 -2
  85. data/spec/service_providers/pacticipants_create_spec.rb +5 -4
  86. data/spec/service_providers/publish_pacts_spec.rb +5 -2
  87. data/spec/service_providers/record_deployment_spec.rb +17 -36
  88. data/spec/service_providers/record_release_spec.rb +132 -0
  89. data/spec/service_providers/record_undeployment_spec.rb +166 -0
  90. data/spec/spec_helper.rb +15 -2
  91. data/spec/support/approvals.rb +26 -0
  92. data/spec/support/shared_context.rb +8 -3
  93. data/tasks/pact.rake +21 -1
  94. metadata +104 -7
  95. data/lib/pact_broker/client/versions/record_deployment.rb +0 -109
  96. data/lib/pact_broker/client/versions/record_undeployment.rb +0 -102
  97. data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +0 -82
@@ -0,0 +1,56 @@
1
+ module PactBroker
2
+ module Client
3
+ module StringRefinements
4
+ refine NilClass do
5
+ def blank?
6
+ true
7
+ end
8
+ end
9
+
10
+ refine String do
11
+ def not_blank?
12
+ !blank?
13
+ end
14
+
15
+ def blank?
16
+ self.strip.size == 0
17
+ end
18
+
19
+ # ripped from rubyworks/facets, thank you
20
+ def snakecase
21
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
22
+ .gsub(/([a-z\d])([A-Z])/,'\1_\2')
23
+ .tr('-', '_')
24
+ .gsub(/\s/, '_')
25
+ .gsub(/__+/, '_')
26
+ .downcase
27
+ end
28
+
29
+ # ripped from rubyworks/facets, thank you
30
+ def camelcase(*separators)
31
+ case separators.first
32
+ when Symbol, TrueClass, FalseClass, NilClass
33
+ first_letter = separators.shift
34
+ end
35
+
36
+ separators = ['_', '\s'] if separators.empty?
37
+
38
+ str = self.dup
39
+
40
+ separators.each do |s|
41
+ str = str.gsub(/(?:#{s}+)([a-z])/){ $1.upcase }
42
+ end
43
+
44
+ case first_letter
45
+ when :upper, true
46
+ str = str.gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase }
47
+ when :lower, false
48
+ str = str.gsub(/(\A|\s)([A-Z])/){ $1 + $2.downcase }
49
+ end
50
+
51
+ str
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.40.0'
3
+ VERSION = '1.45.0'
4
4
  end
5
5
  end
@@ -1,4 +1,7 @@
1
- require_relative 'base_client'
1
+ require 'pact_broker/client/base_client'
2
+ require 'pact_broker/client/versions/describe'
3
+
4
+ # Old code
2
5
  require 'pact_broker/client/pacts'
3
6
 
4
7
  module PactBroker
@@ -1,9 +1,11 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'pact_broker/client/pact_broker_client'
2
4
  require 'pact_broker/client/versions/formatter'
3
5
 
4
6
  module PactBroker
5
7
  module Client
6
- class Versions
8
+ class Versions < BaseClient
7
9
  class Describe
8
10
 
9
11
  class Result
@@ -1,9 +1,11 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'pact_broker/client/versions/json_formatter'
2
4
  require 'pact_broker/client/versions/text_formatter'
3
5
 
4
6
  module PactBroker
5
7
  module Client
6
- class Versions
8
+ class Versions < BaseClient
7
9
  class Formatter
8
10
  def self.call(matrix_lines, format)
9
11
  formatter = case format
@@ -1,11 +1,13 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'table_print'
2
4
 
3
5
  module PactBroker
4
6
  module Client
5
- class Versions
7
+ class Versions < BaseClient
6
8
  class JsonFormatter
7
- def self.call(matrix)
8
- JSON.pretty_generate(matrix)
9
+ def self.call(version)
10
+ JSON.pretty_generate(version)
9
11
  end
10
12
  end
11
13
  end
@@ -1,8 +1,10 @@
1
+ # Need Versions class to extend BaseClient until we can remove the old Versions code
2
+ require 'pact_broker/client/base_client'
1
3
  require 'table_print'
2
4
 
3
5
  module PactBroker
4
6
  module Client
5
- class Versions
7
+ class Versions < BaseClient
6
8
  class TextFormatter
7
9
 
8
10
  Line = Struct.new(:number, :tags)
@@ -33,4 +33,6 @@ Gem::Specification.new do |gem|
33
33
  gem.add_development_dependency 'conventional-changelog', '~>1.3'
34
34
  gem.add_development_dependency 'pact', '~> 1.16'
35
35
  gem.add_development_dependency 'pact-support', '~> 1.16'
36
+ gem.add_development_dependency 'approvals', '>=0.0.24', '<1.0.0'
37
+ gem.add_development_dependency 'rspec-its', '~> 1.3'
36
38
  end
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ for file in $(find spec/fixtures/approvals -ipath "*.received.*"); do
4
+ approved_path=$(echo "$file" | sed 's/received/approved/')
5
+ mv "$file" "$approved_path"
6
+ done;
@@ -1,3 +1,6 @@
1
+ export PACT_BROKER_BASE_URL="http://localhost:9292"
2
+ export PACT_BROKER_TOKEN="localhost"
3
+
1
4
  # bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
2
5
  # --uuid d40f38c3-aaa3-47f5-9161-95c07bc16b14 \
3
6
  # --request POST \
@@ -5,18 +8,18 @@
5
8
  # --contract-published
6
9
 
7
10
  bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
8
- --uuid d40f38c3-aaa3-47f5-9161-95c07bc16555 \
9
- --provider Bar \
11
+ --uuid d40f38c3-aaa3-47f5-9161-95csfadfsd7 \
12
+ --description "This is quite a long description for a webhook that I hope will be truncated" \
10
13
  --request POST \
11
14
  --contract-published
12
15
 
13
- bundle exec bin/pact-broker publish spec/pacts/pact_broker_client-pact_broker.json spec/pacts/foo-bar.json \
14
- --consumer-app-version 1.2.12 \
15
- --broker-base-url http://localhost:9292 \
16
- --broker-username localhost --broker-password localhost \
17
- --auto-detect-version-properties \
18
- --build-url http://mybuild \
19
- --branch master --tag foo5
16
+ # bundle exec bin/pact-broker publish spec/pacts/pact_broker_client-pact_broker.json spec/fixtures/foo-bar.json \
17
+ # --consumer-app-version 1.2.12 \
18
+ # --broker-base-url http://localhost:9292 \
19
+ # --broker-username localhost --broker-password localhost \
20
+ # --auto-detect-version-properties \
21
+ # --build-url http://mybuild \
22
+ # --branch master --tag foo5
20
23
 
21
24
  # bundle exec bin/pact-broker create-or-update-webhook http://localhost:9393 \
22
25
  # --uuid d40f38c3-aaa3-47f5-9161-95c07bc16555 \
@@ -0,0 +1,18 @@
1
+ export PACT_BROKER_FEATURES=deployments
2
+
3
+ bundle exec bin/pact-broker create-or-update-pacticipant --name Foo
4
+ bundle exec bin/pact-broker create-version-tag --pacticipant Foo --version 2 --tag main --auto-create-version
5
+ bundle exec bin/pact-broker describe-version --pacticipant Foo --version 2
6
+ bundle exec bin/pact-broker create-environment --name test
7
+ bundle exec bin/pact-broker can-i-deploy --pacticipant Foo --version 2 --to-environment test
8
+
9
+ bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test
10
+ bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test --target customer-1
11
+ bundle exec bin/pact-broker record-deployment --pacticipant Foo --version 2 --environment test --target customer-1
12
+
13
+ bundle exec bin/pact-broker record-undeployment --pacticipant Foo --environment test
14
+ bundle exec bin/pact-broker record-undeployment --pacticipant Foo --environment test
15
+ bundle exec bin/pact-broker record-undeployment --pacticipant Foo --environment test --target customer-1
16
+
17
+ bundle exec bin/pact-broker record-release --pacticipant Foo --version 2 --environment test
18
+ bundle exec bin/pact-broker record-support-ended --pacticipant Foo --version 2 --environment test
@@ -0,0 +1,7 @@
1
+ [dry-run] Computer says no ¯\_(ツ)_/¯ (but you're ignoring this by enabling dry run)
2
+ [dry-run] 
3
+ [dry-run] text matrix
4
+ [dry-run] 
5
+ [dry-run] some reason
6
+ [dry-run] 
7
+ [dry-run] Dry run enabled - ignoring any failures
@@ -0,0 +1,13 @@
1
+ Computer says yes \o/ 
2
+
3
+ CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS? | RESULT#
4
+ ---------|-----------|----------|-----------|-----------------|--------
5
+ Foo | 1.2.3 | Bar | 4.5.6 | true | 1
6
+ Foo | 3.4.5 | Bar | 4.5.6 | false [ignored] | 2
7
+
8
+ VERIFICATION RESULTS
9
+ --------------------
10
+ 1. http://result (success)
11
+ 2. http://result (failure)
12
+
13
+ some notice
@@ -0,0 +1,7 @@
1
+ [dry-run] Computer says yes \o/ (and maybe you don't need to enable dry run)
2
+ [dry-run] 
3
+ [dry-run] text matrix
4
+ [dry-run] 
5
+ [dry-run] some reason
6
+ [dry-run] 
7
+ [dry-run] Dry run enabled - ignoring any failures
@@ -0,0 +1,7 @@
1
+ Name: existing name
2
+ Display Name: existing display name
3
+ Production: true
4
+ Contacts:
5
+ - Name: Someone
6
+ Details:
7
+ Email Address: foo@bar.com
@@ -0,0 +1,2 @@
1
+ Name: Pricing Service
2
+ Repository Url: git@git.realestate.com.au:business-systems/pricing-service
@@ -0,0 +1,3 @@
1
+ UUID | NAME | DISPLAY NAME | PRODUCTION
2
+ -------------------------------------|------|--------------|-----------
3
+ 78e85fb2-9df1-48da-817e-c9bea6294e01 | test | Test | false
@@ -0,0 +1,31 @@
1
+ require 'pact_broker/client/cli/broker'
2
+
3
+ RSpec.describe "describe-environment" do
4
+ let(:index_body_hash) do
5
+ {
6
+ _links: {
7
+ "pb:pacticipant" => {
8
+ href: "http://broker/pacticipants/{pacticipant}"
9
+ }
10
+ }
11
+ }
12
+ end
13
+
14
+ let(:pacticipant_body_hash) { JSON.parse(File.read("./spec/support/pacticipant_get.json")) }
15
+
16
+ let!(:index_request) do
17
+ stub_request(:get, "http://broker").to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
18
+ end
19
+
20
+ let!(:pacticipant_request) do
21
+ stub_request(:get, "http://broker/pacticipants/Foo").to_return(status: 200, body: pacticipant_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
22
+ end
23
+
24
+ let(:parameters) { %w{describe-pacticipant --name Foo --broker-base-url http://broker} }
25
+
26
+ subject { capture(:stdout) { PactBroker::Client::CLI::Broker.start(parameters) } }
27
+
28
+ it "prints the pacticipant properties" do
29
+ Approvals.verify(subject, :name => "describe_pacticipant", format: :txt)
30
+ end
31
+ end
@@ -6,22 +6,28 @@ module PactBroker
6
6
  describe CanIDeploy do
7
7
  let(:pact_broker_base_url) { 'http://example.org' }
8
8
  let(:version_selectors) { [{ pacticipant: "Foo", version: "1" }] }
9
- let(:matrix_options) { {} }
9
+ let(:matrix_options) { { } }
10
10
  let(:pact_broker_client_options) { { foo: 'bar' } }
11
+ let(:dry_run) { false }
11
12
  let(:matrix_client) { instance_double('PactBroker::Client::Matrix') }
12
13
  let(:matrix) do
13
14
  instance_double('Matrix::Resource',
14
- deployable?: true,
15
+ deployable?: deployable,
15
16
  reason: 'some reason',
16
17
  any_unknown?: any_unknown,
17
18
  supports_unknown_count?: supports_unknown_count,
18
- unknown_count: unknown_count)
19
+ supports_ignore?: supports_ignore,
20
+ unknown_count: unknown_count,
21
+ notices: notices)
19
22
  end
20
23
  let(:unknown_count) { 0 }
21
24
  let(:any_unknown) { unknown_count > 0 }
22
25
  let(:supports_unknown_count) { true }
23
26
  let(:retry_while_unknown) { 0 }
24
- let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5 } }
27
+ let(:options) { { output: 'text', retry_while_unknown: retry_while_unknown, retry_interval: 5, dry_run: dry_run } }
28
+ let(:notices) { nil }
29
+ let(:supports_ignore) { true }
30
+ let(:deployable) { true }
25
31
 
26
32
 
27
33
  before do
@@ -55,10 +61,27 @@ module PactBroker
55
61
  it "returns a success reason" do
56
62
  expect(subject.message).to include "some reason"
57
63
  end
64
+
65
+ context "when there are notices" do
66
+ let(:notices) { [Notice.new(text: "some notice", type: "info")] }
67
+
68
+ it "returns the notices instead of the reason" do
69
+ expect(subject.message).to_not include "some reason"
70
+ expect(subject.message).to include "some notice"
71
+ end
72
+ end
73
+
74
+ context "when dry_run is enabled" do
75
+ let(:dry_run) { true }
76
+
77
+ it "prefixes each line with [dry-run]" do
78
+ Approvals.verify(subject.message, :name => "can_i_deploy_success_dry_run", format: :txt)
79
+ end
80
+ end
58
81
  end
59
82
 
60
83
  context "when the versions are not deployable" do
61
- let(:matrix) { instance_double('Matrix::Resource', deployable?: false, reason: 'some reason', any_unknown?: false) }
84
+ let(:matrix) { instance_double('Matrix::Resource', deployable?: false, reason: 'some reason', any_unknown?: false, notices: notices) }
62
85
 
63
86
  it "returns a failure response" do
64
87
  expect(subject.success).to be false
@@ -71,6 +94,27 @@ module PactBroker
71
94
  it "returns a failure reason" do
72
95
  expect(subject.message).to include "some reason"
73
96
  end
97
+
98
+ context "when there are notices" do
99
+ let(:notices) { [Notice.new(text: "some notice", type: "info")] }
100
+
101
+ it "returns the notices instead of the reason" do
102
+ expect(subject.message).to_not include "some reason"
103
+ expect(subject.message).to include "some notice"
104
+ end
105
+ end
106
+
107
+ context "when dry_run is enabled" do
108
+ let(:dry_run) { true }
109
+
110
+ it "returns a success response" do
111
+ expect(subject.success).to be true
112
+ end
113
+
114
+ it "prefixes each line with [dry-run]" do
115
+ Approvals.verify(subject.message, :name => "can_i_deploy_failure_dry_run", format: :txt)
116
+ end
117
+ end
74
118
  end
75
119
 
76
120
  context "when retry_while_unknown is greater than 0" do
@@ -112,6 +156,38 @@ module PactBroker
112
156
  it "returns a failure message" do
113
157
  expect(subject.message).to match /does not provide a count/
114
158
  end
159
+
160
+ context "when dry_run is enabled" do
161
+ let(:dry_run) { true }
162
+
163
+ it "returns a success response" do
164
+ expect(subject.success).to be true
165
+ end
166
+
167
+ it "returns a failure message" do
168
+ expect(subject.message).to include "[dry-run]"
169
+ expect(subject.message).to match /does not provide a count/
170
+ end
171
+ end
172
+ end
173
+ end
174
+
175
+ context "when there are ignore selectors but the matrix does not support ignoring" do
176
+ let(:matrix_options) { { ignore_selectors: [{ pacticipant_name: "Foo" }]} }
177
+ let(:supports_ignore) { false }
178
+
179
+ context "when deployable" do
180
+ it "returns a warning" do
181
+ expect(subject.message).to include "does not support"
182
+ end
183
+ end
184
+
185
+ context "when not deployable" do
186
+ let(:deployable) { false }
187
+
188
+ it "returns a warning" do
189
+ expect(subject.message).to include "does not support"
190
+ end
115
191
  end
116
192
  end
117
193
 
@@ -125,7 +201,20 @@ module PactBroker
125
201
  end
126
202
 
127
203
  it "returns a failure message" do
128
- expect(subject.message).to eq "error text"
204
+ expect(subject.message).to include "error text"
205
+ end
206
+
207
+ context "when dry_run is enabled" do
208
+ let(:dry_run) { true }
209
+
210
+ it "returns a success response" do
211
+ expect(subject.success).to be true
212
+ end
213
+
214
+ it "returns a failure message" do
215
+ expect(subject.message).to include "[dry-run]"
216
+ expect(subject.message).to match /error text/
217
+ end
129
218
  end
130
219
  end
131
220
 
@@ -141,7 +230,20 @@ module PactBroker
141
230
  end
142
231
 
143
232
  it "returns a failure message and backtrace" do
144
- expect(subject.message).to include "Error retrieving matrix. StandardError - error text\n"
233
+ expect(subject.message).to include "Error retrieving matrix. StandardError - error text"
234
+ end
235
+
236
+ context "when dry_run is enabled" do
237
+ let(:dry_run) { true }
238
+
239
+ it "returns a success response" do
240
+ expect(subject.success).to be true
241
+ end
242
+
243
+ it "returns a failure message" do
244
+ expect(subject.message).to include "[dry-run]"
245
+ expect(subject.message).to match /error text/
246
+ end
145
247
  end
146
248
  end
147
249
  end