pact_broker 2.52.1 → 2.56.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +80 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/README.md +2 -4
- data/db/migrations/20180828_create_latest_versions.rb +1 -1
- data/lib/pact_broker/api.rb +8 -0
- data/lib/pact_broker/api/contracts/webhook_contract.rb +8 -6
- data/lib/pact_broker/api/decorators/decorator_context.rb +6 -11
- data/lib/pact_broker/api/decorators/reason_decorator.rb +17 -0
- data/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +6 -1
- data/lib/pact_broker/api/pact_broker_urls.rb +6 -2
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +14 -14
- data/lib/pact_broker/api/resources/badge.rb +6 -2
- data/lib/pact_broker/api/resources/base_resource.rb +3 -3
- data/lib/pact_broker/api/resources/matrix_badge.rb +5 -0
- data/lib/pact_broker/api/resources/pact.rb +1 -17
- data/lib/pact_broker/api/resources/pacticipant.rb +0 -4
- data/lib/pact_broker/api/resources/pacticipants.rb +3 -2
- data/lib/pact_broker/api/resources/verifications.rb +0 -4
- data/lib/pact_broker/app.rb +13 -4
- data/lib/pact_broker/badges/service.rb +16 -13
- data/lib/pact_broker/db.rb +9 -1
- data/lib/pact_broker/doc/controllers/app.rb +11 -1
- data/lib/pact_broker/doc/views/layouts/main.haml +1 -1
- data/lib/pact_broker/domain/verification.rb +13 -0
- data/lib/pact_broker/hash_refinements.rb +4 -0
- data/lib/pact_broker/integrations/service.rb +2 -2
- data/lib/pact_broker/locale/en.yml +1 -1
- data/lib/pact_broker/logging.rb +3 -1
- data/lib/pact_broker/matrix/deployment_status_summary.rb +23 -1
- data/lib/pact_broker/matrix/reason.rb +9 -0
- data/lib/pact_broker/matrix/unresolved_selector.rb +4 -0
- data/lib/pact_broker/pacticipants/repository.rb +6 -0
- data/lib/pact_broker/pacticipants/service.rb +8 -0
- data/lib/pact_broker/pacts/content.rb +26 -2
- data/lib/pact_broker/pacts/repository.rb +5 -4
- data/lib/pact_broker/tasks/migration_task.rb +20 -1
- data/lib/pact_broker/test/test_data_builder.rb +8 -3
- data/lib/pact_broker/ui/app.rb +1 -0
- data/lib/pact_broker/ui/controllers/base_controller.rb +3 -0
- data/lib/pact_broker/ui/controllers/clusters.rb +2 -2
- data/lib/pact_broker/ui/controllers/groups.rb +3 -2
- data/lib/pact_broker/ui/controllers/index.rb +3 -2
- data/lib/pact_broker/ui/controllers/matrix.rb +19 -3
- data/lib/pact_broker/ui/helpers/url_helper.rb +4 -4
- data/lib/pact_broker/ui/view_models/index_item.rb +16 -11
- data/lib/pact_broker/ui/view_models/index_items.rb +2 -2
- data/lib/pact_broker/ui/view_models/matrix_line.rb +12 -7
- data/lib/pact_broker/ui/view_models/matrix_lines.rb +2 -2
- data/lib/pact_broker/ui/views/groups/show.html.erb +3 -3
- data/lib/pact_broker/ui/views/index/_css_and_js.haml +9 -9
- data/lib/pact_broker/ui/views/index/_navbar.haml +3 -3
- data/lib/pact_broker/ui/views/index/_pagination.haml +1 -1
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +3 -3
- data/lib/pact_broker/ui/views/index/show.haml +3 -3
- data/lib/pact_broker/ui/views/layouts/main.haml +4 -4
- data/lib/pact_broker/ui/views/matrix/show.haml +14 -11
- data/lib/pact_broker/verifications/repository.rb +4 -5
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/service.rb +4 -3
- data/lib/pact_broker/webhooks/webhook_event.rb +1 -1
- data/lib/pact_broker/webhooks/webhook_request_logger.rb +8 -8
- data/pact_broker.gemspec +2 -2
- data/public/javascripts/pact.js +7 -6
- data/public/stylesheets/matrix.css +13 -0
- data/script/foo-bar-verification.json +3 -1
- data/script/foo-bar.json +11 -0
- data/script/seed.rb +1 -1
- data/spec/features/create_webhook_spec.rb +1 -1
- data/spec/features/delete_integration_spec.rb +2 -2
- data/spec/features/get_matrix_badge_spec.rb +9 -0
- data/spec/fixtures/webhook_valid.json +1 -1
- data/spec/fixtures/webhook_valid_with_pacticipants.json +1 -1
- data/spec/integration/ui/index_spec.rb +16 -0
- data/spec/integration/ui/matrix_spec.rb +11 -4
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +12 -0
- data/spec/lib/pact_broker/api/decorators/pact_version_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/decorators/reason_decorator_spec.rb +18 -1
- data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +8 -0
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/badge_spec.rb +42 -22
- data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +1 -1
- data/spec/lib/pact_broker/badges/service_spec.rb +15 -3
- data/spec/lib/pact_broker/doc/controllers/app_spec.rb +16 -0
- data/spec/lib/pact_broker/domain/version_spec.rb +7 -7
- data/spec/lib/pact_broker/integrations/service_spec.rb +6 -0
- data/spec/lib/pact_broker/matrix/deployment_status_summary_spec.rb +6 -2
- data/spec/lib/pact_broker/matrix/integration_spec.rb +43 -0
- data/spec/lib/pact_broker/pacts/content_spec.rb +125 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +18 -1
- data/spec/lib/pact_broker/verifications/repository_spec.rb +20 -0
- data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +4 -1
- data/spec/migrations/rollback_spec.rb +6 -0
- data/spec/service_consumers/provider_states_for_pact_broker_client.rb +11 -0
- data/vendor/hal-browser/README.adoc +169 -0
- data/vendor/hal-browser/browser.html +36 -22
- data/vendor/hal-browser/js/hal.js +30 -7
- data/vendor/hal-browser/js/hal/http/client.js +14 -6
- data/vendor/hal-browser/js/hal/resource.js +4 -2
- data/vendor/hal-browser/js/hal/views/documentation.js +1 -1
- data/vendor/hal-browser/js/hal/views/embedded_resource.js +10 -4
- data/vendor/hal-browser/js/hal/views/links.js +3 -2
- data/vendor/hal-browser/js/hal/views/non_safe_request_dialog.js +1 -1
- data/vendor/hal-browser/js/hal/views/properties.js +101 -2
- data/vendor/hal-browser/js/hal/views/query_uri_dialog.js +1 -1
- data/vendor/hal-browser/js/hal/views/request_headers.js +1 -1
- data/vendor/hal-browser/js/hal/views/resource.js +4 -3
- data/vendor/hal-browser/js/hal/views/response_headers.js +12 -1
- data/vendor/hal-browser/login.html +76 -0
- data/vendor/hal-browser/styles.css +3 -1
- data/vendor/hal-browser/vendor/js/URI.min.js +84 -0
- metadata +31 -28
- data/lib/pact_broker/verifications/all_verifications.rb +0 -41
- data/vendor/hal-browser/README.md +0 -41
@@ -1,9 +1,9 @@
|
|
1
|
-
%link{rel: 'stylesheet', href:
|
2
|
-
%link{rel: 'stylesheet', href:
|
3
|
-
%link{rel: 'stylesheet', href:
|
4
|
-
%link{rel: 'stylesheet', href:
|
5
|
-
%script{type: 'text/javascript', src:
|
6
|
-
%script{type: 'text/javascript', src:
|
7
|
-
%script{type: 'text/javascript', src:
|
8
|
-
%script{type: 'text/javascript', src:
|
9
|
-
%script{type: 'text/javascript', src:
|
1
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/index.css"}
|
2
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/material-menu.css"}
|
3
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/material-icon.css"}
|
4
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/jquery-confirm.min.css"}
|
5
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/jquery.tablesorter.min.js"}
|
6
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/material-menu.js"}
|
7
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/index.js"}
|
8
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/clipboard.js"}
|
9
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/jquery-confirm.min.js"}
|
@@ -4,11 +4,11 @@
|
|
4
4
|
%ul.navbar-right#top-left-menu
|
5
5
|
%li
|
6
6
|
- if tag_toggle
|
7
|
-
%a{href:
|
7
|
+
%a{href: "#{base_url}?tags=true"}
|
8
8
|
Show latest tags
|
9
9
|
- else
|
10
|
-
%a{href:
|
10
|
+
%a{href: "#{base_url}/"}
|
11
11
|
Hide latest tags
|
12
12
|
|
13
|
-
%a{href:
|
13
|
+
%a{href: "#{base_url}/hal-browser/browser.html"}
|
14
14
|
API Browser
|
@@ -1,7 +1,7 @@
|
|
1
1
|
%body
|
2
2
|
= render :haml, :'index/_css_and_js', :layout => false
|
3
3
|
.container
|
4
|
-
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: false}
|
4
|
+
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: false, base_url: base_url}
|
5
5
|
- if index_items.empty?
|
6
6
|
= render :haml, :'index/_getting-started', :layout => false
|
7
7
|
%h1.page-header
|
@@ -96,8 +96,8 @@
|
|
96
96
|
$(document).ready(function(){
|
97
97
|
initializeClipper(".clippable");
|
98
98
|
|
99
|
-
$("span.pact a").load("/images/doc-text.svg");
|
100
|
-
$("span.pact-matrix a").load("/images/doc-matrix.svg");
|
99
|
+
$("span.pact a").load("#{base_url}/images/doc-text.svg");
|
100
|
+
$("span.pact-matrix a").load("#{base_url}/images/doc-matrix.svg");
|
101
101
|
$('td[data-toggle="tooltip"]').each(function(index, td){
|
102
102
|
//appended tooltip div screws up table if it's appended after a
|
103
103
|
//td, so need to append it to a div
|
@@ -1,7 +1,7 @@
|
|
1
1
|
%body
|
2
2
|
= render :haml, :'index/_css_and_js', :layout => false
|
3
3
|
.container
|
4
|
-
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: true}
|
4
|
+
= render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: true, base_url: base_url}
|
5
5
|
- if index_items.empty?
|
6
6
|
= render :haml, :'index/_getting-started', :layout => false
|
7
7
|
%h1.page-header
|
@@ -67,8 +67,8 @@
|
|
67
67
|
});
|
68
68
|
|
69
69
|
$(document).ready(function(){
|
70
|
-
$("span.pact a").load("/images/doc-text.svg");
|
71
|
-
$("span.pact-matrix a").load("/images/doc-matrix.svg");
|
70
|
+
$("span.pact a").load("#{base_url}/images/doc-text.svg");
|
71
|
+
$("span.pact-matrix a").load("#{base_url}/images/doc-matrix.svg");
|
72
72
|
$('td[data-toggle="tooltip"]').each(function(index, td){
|
73
73
|
//appended tooltip div screws up table if it's appended after a
|
74
74
|
//td, so need to append it to a div
|
@@ -2,8 +2,8 @@
|
|
2
2
|
%html
|
3
3
|
%head
|
4
4
|
%title= defined?(title) ? title : ""
|
5
|
-
%link{rel: 'shortcut icon', href:
|
6
|
-
%link{rel: 'stylesheet', href:
|
7
|
-
%script{type: 'text/javascript', src:
|
8
|
-
%script{type: 'text/javascript', src:
|
5
|
+
%link{rel: 'shortcut icon', href: "#{base_url}/images/favicon.ico", type:'image/x-icon'}
|
6
|
+
%link{rel: 'stylesheet', href: "#{base_url}/css/bootstrap.min.css"}
|
7
|
+
%script{type: 'text/javascript', src:"#{base_url}/javascripts/jquery-3.3.1.min.js"}
|
8
|
+
%script{type: 'text/javascript', src:"#{base_url}/js/bootstrap.min.js"}
|
9
9
|
= yield
|
@@ -1,31 +1,34 @@
|
|
1
1
|
%body
|
2
|
-
%link{rel: 'stylesheet', href:
|
3
|
-
%link{rel: 'stylesheet', href:
|
4
|
-
%link{rel: 'stylesheet', href:
|
5
|
-
%script{type: 'text/javascript', src:
|
6
|
-
%script{type: 'text/javascript', src:
|
7
|
-
%script{type: 'text/javascript', src:
|
8
|
-
%script{type: 'text/javascript', src:
|
9
|
-
%script{type: 'text/javascript', src:
|
2
|
+
%link{rel: 'stylesheet', href: "#{base_url}/css/bootstrap.min.css"}
|
3
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/index.css"}
|
4
|
+
%link{rel: 'stylesheet', href: "#{base_url}/stylesheets/matrix.css"}
|
5
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/jquery-3.3.1.min.js"}
|
6
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/jquery.tablesorter.min.js"}
|
7
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/matrix.js"}
|
8
|
+
%script{type: 'text/javascript', src: "#{base_url}/javascripts/clipboard.js"}
|
9
|
+
%script{type: 'text/javascript', src: "#{base_url}/js/bootstrap.min.js"}
|
10
10
|
|
11
11
|
.container
|
12
12
|
.navbar-right
|
13
|
-
%a{href:
|
13
|
+
%a{href: base_url}
|
14
14
|
Home
|
15
15
|
%h1.page-header
|
16
16
|
= title
|
17
|
+
- if defined?(badge_url) && badge_url
|
18
|
+
%img{src: badge_url, class: 'pact_badge' }
|
17
19
|
|
18
20
|
- if defined?(errors) && errors.any?
|
19
21
|
- errors.each do | error |
|
20
22
|
%div.alert.alert-danger
|
21
23
|
= escape_html(error)
|
22
24
|
|
23
|
-
|
25
|
+
|
26
|
+
%form{action: "#{base_url}/matrix", onsubmit:'return onSubmit()'}
|
24
27
|
- selectors.each_with_index do | selector, index |
|
25
28
|
.selector
|
26
29
|
%label{for: "pacticipant#{index}"}
|
27
30
|
Pacticipant name
|
28
|
-
%input{name: 'q[]pacticipant', id: "pacticipant1#{index}", value: escape_html(selector.pacticipant_name)}
|
31
|
+
%input{name: 'q[]pacticipant', id: "pacticipant1#{index}", class: 'pacticipant_name', value: escape_html(selector.pacticipant_name)}
|
29
32
|
|
30
33
|
.input-group
|
31
34
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'sequel'
|
2
2
|
require 'pact_broker/domain/verification'
|
3
3
|
require 'pact_broker/verifications/latest_verification_for_pact_version'
|
4
|
-
require 'pact_broker/verifications/all_verifications'
|
5
4
|
require 'pact_broker/verifications/sequence'
|
6
5
|
require 'pact_broker/verifications/latest_verification_id_for_pact_version_and_provider_version'
|
7
6
|
|
@@ -107,8 +106,8 @@ module PactBroker
|
|
107
106
|
|
108
107
|
def find_latest_verification_for_tags consumer_name, provider_name, consumer_version_tag, provider_version_tag
|
109
108
|
view_name = PactBroker::Domain::Verification.table_name
|
110
|
-
consumer = pacticipant_repository.find_by_name(consumer_name)
|
111
|
-
provider = pacticipant_repository.find_by_name(provider_name)
|
109
|
+
consumer = pacticipant_repository.find_by_name!(consumer_name)
|
110
|
+
provider = pacticipant_repository.find_by_name!(provider_name)
|
112
111
|
|
113
112
|
consumer_tag_filter = PactBroker::Repositories::Helpers.name_like(Sequel.qualify(:consumer_tags, :name), consumer_version_tag)
|
114
113
|
provider_tag_filter = PactBroker::Repositories::Helpers.name_like(Sequel.qualify(:provider_tags, :name), provider_version_tag)
|
@@ -137,8 +136,8 @@ module PactBroker
|
|
137
136
|
end
|
138
137
|
|
139
138
|
def delete_all_verifications_between(consumer_name, options)
|
140
|
-
consumer = pacticipant_repository.find_by_name(consumer_name)
|
141
|
-
provider = pacticipant_repository.find_by_name(options.fetch(:and))
|
139
|
+
consumer = pacticipant_repository.find_by_name!(consumer_name)
|
140
|
+
provider = pacticipant_repository.find_by_name!(options.fetch(:and))
|
142
141
|
PactBroker::Domain::Verification.where(provider: provider, consumer: consumer).delete
|
143
142
|
end
|
144
143
|
|
data/lib/pact_broker/version.rb
CHANGED
@@ -40,12 +40,13 @@ module PactBroker
|
|
40
40
|
def self.errors webhook, uuid = nil
|
41
41
|
contract = PactBroker::Api::Contracts::WebhookContract.new(webhook)
|
42
42
|
contract.validate(webhook.attributes)
|
43
|
-
|
43
|
+
messages = contract.errors.messages
|
44
44
|
|
45
45
|
if uuid && !valid_uuid_format?(uuid)
|
46
|
-
|
46
|
+
messages["uuid"] = [message("errors.validation.invalid_webhook_uuid")]
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
|
+
OpenStruct.new(messages: messages, empty?: messages.empty?, any?: messages.any?)
|
49
50
|
end
|
50
51
|
|
51
52
|
def self.create uuid, webhook, consumer, provider
|
@@ -12,7 +12,7 @@ module PactBroker
|
|
12
12
|
VERIFICATION_FAILED = 'provider_verification_failed'
|
13
13
|
DEFAULT_EVENT_NAME = CONTRACT_CONTENT_CHANGED
|
14
14
|
|
15
|
-
EVENT_NAMES = [CONTRACT_PUBLISHED, CONTRACT_CONTENT_CHANGED, VERIFICATION_PUBLISHED, VERIFICATION_FAILED]
|
15
|
+
EVENT_NAMES = [CONTRACT_PUBLISHED, CONTRACT_CONTENT_CHANGED, VERIFICATION_PUBLISHED, VERIFICATION_SUCCEEDED, VERIFICATION_FAILED]
|
16
16
|
|
17
17
|
dataset_module do
|
18
18
|
include PactBroker::Repositories::Helpers
|
@@ -33,8 +33,8 @@ module PactBroker
|
|
33
33
|
safe_response = http_response ? HttpResponseWithUtf8SafeBody.new(http_response) : nil
|
34
34
|
log_webhook_context(webhook_context)
|
35
35
|
log_request(webhook_request)
|
36
|
-
log_response(uuid, safe_response) if safe_response
|
37
|
-
log_error(uuid, error) if error
|
36
|
+
log_response(uuid, safe_response, webhook_context[:base_url]) if safe_response
|
37
|
+
log_error(uuid, error, webhook_context[:base_url]) if error
|
38
38
|
log_completion_message(success?(safe_response))
|
39
39
|
log_stream.string
|
40
40
|
end
|
@@ -61,17 +61,17 @@ module PactBroker
|
|
61
61
|
execution_logger.info(webhook_request.body) if webhook_request.body
|
62
62
|
end
|
63
63
|
|
64
|
-
def log_response uuid, response
|
64
|
+
def log_response uuid, response, base_url
|
65
65
|
log_response_to_application_logger(uuid, response)
|
66
66
|
if options.fetch(:show_response)
|
67
67
|
log_response_to_execution_logger(response)
|
68
68
|
else
|
69
|
-
execution_logger.info response_body_hidden_message
|
69
|
+
execution_logger.info response_body_hidden_message(base_url)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
def response_body_hidden_message
|
74
|
-
PactBroker::Messages.message('messages.response_body_hidden')
|
73
|
+
def response_body_hidden_message(base_url)
|
74
|
+
PactBroker::Messages.message('messages.response_body_hidden', base_url: base_url)
|
75
75
|
end
|
76
76
|
|
77
77
|
def log_response_to_application_logger uuid, response
|
@@ -106,13 +106,13 @@ module PactBroker
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
def log_error uuid, e
|
109
|
+
def log_error uuid, e, base_url
|
110
110
|
logger.info "Error executing webhook #{uuid} #{e.class.name} - #{e.message} #{e.backtrace.join("\n")}"
|
111
111
|
|
112
112
|
if options[:show_response]
|
113
113
|
execution_logger.error "Error executing webhook #{uuid} #{e.class.name} - #{e.message}"
|
114
114
|
else
|
115
|
-
execution_logger.error "Error executing webhook #{uuid}. #{response_body_hidden_message}"
|
115
|
+
execution_logger.error "Error executing webhook #{uuid}. #{response_body_hidden_message(base_url)}"
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
data/pact_broker.gemspec
CHANGED
@@ -46,12 +46,12 @@ Gem::Specification.new do |gem|
|
|
46
46
|
gem.add_runtime_dependency 'httparty', '~> 0.14'
|
47
47
|
gem.add_runtime_dependency 'json', '~> 2.3'
|
48
48
|
gem.add_runtime_dependency 'roar', '~> 1.1'
|
49
|
-
gem.add_runtime_dependency 'reform', '~> 2.2'
|
49
|
+
gem.add_runtime_dependency 'reform', '~> 2.3','>= 2.3.1'
|
50
50
|
gem.add_runtime_dependency 'dry-validation', '~> 0.10.5'
|
51
51
|
gem.add_runtime_dependency 'sequel', '~> 5.28'
|
52
52
|
gem.add_runtime_dependency 'webmachine', '1.5.0'
|
53
53
|
gem.add_runtime_dependency 'semver2', '~> 3.4.2'
|
54
|
-
gem.add_runtime_dependency 'rack', '
|
54
|
+
gem.add_runtime_dependency 'rack', '~> 2.2'
|
55
55
|
gem.add_runtime_dependency 'redcarpet', '>=3.3.2', '~>3.3'
|
56
56
|
gem.add_runtime_dependency 'pact-support', '~> 1.14', '>= 1.14.1'
|
57
57
|
gem.add_runtime_dependency 'padrino-core', '>= 0.14.3', '~> 0.14'
|
data/public/javascripts/pact.js
CHANGED
@@ -74,7 +74,7 @@ function promptToDeleteResource(deletionUrl, confirmationText) {
|
|
74
74
|
confirmDeleteResource(confirmationText, confirmed, cancelled);
|
75
75
|
}
|
76
76
|
|
77
|
-
function createWhereToNextConfirmationConfiguration(latestPactUrl) {
|
77
|
+
function createWhereToNextConfirmationConfiguration(latestPactUrl, indexUrl) {
|
78
78
|
return {
|
79
79
|
title: "Pact deleted",
|
80
80
|
content: "Where to next?",
|
@@ -89,14 +89,14 @@ function createWhereToNextConfirmationConfiguration(latestPactUrl) {
|
|
89
89
|
home: {
|
90
90
|
text: "Home",
|
91
91
|
action: function() {
|
92
|
-
window.location.href =
|
92
|
+
window.location.href = indexUrl;
|
93
93
|
}
|
94
94
|
}
|
95
95
|
}
|
96
96
|
};
|
97
97
|
}
|
98
98
|
|
99
|
-
function createAllPactsDeletedConfirmationConfiguration() {
|
99
|
+
function createAllPactsDeletedConfirmationConfiguration(indexUrl) {
|
100
100
|
return {
|
101
101
|
title: "Pact deleted",
|
102
102
|
content: "All versions of this pact have now been deleted.",
|
@@ -104,7 +104,7 @@ function createAllPactsDeletedConfirmationConfiguration() {
|
|
104
104
|
home: {
|
105
105
|
text: "Home",
|
106
106
|
action: function() {
|
107
|
-
window.location.href =
|
107
|
+
window.location.href = indexUrl;
|
108
108
|
}
|
109
109
|
}
|
110
110
|
}
|
@@ -115,11 +115,12 @@ function handleDeletionSuccess(responseBody) {
|
|
115
115
|
if (responseBody._links["pb:latest-pact-version"]) {
|
116
116
|
$.confirm(
|
117
117
|
createWhereToNextConfirmationConfiguration(
|
118
|
-
responseBody._links["pb:latest-pact-version"].href
|
118
|
+
responseBody._links["pb:latest-pact-version"].href,
|
119
|
+
responseBody._links["index"].href
|
119
120
|
)
|
120
121
|
);
|
121
122
|
} else {
|
122
|
-
$.confirm(createAllPactsDeletedConfirmationConfiguration());
|
123
|
+
$.confirm(createAllPactsDeletedConfirmationConfiguration(responseBody._links["index"].href));
|
123
124
|
}
|
124
125
|
}
|
125
126
|
|
@@ -28,3 +28,16 @@ span.pre-verified-icon {
|
|
28
28
|
td.pact-published .tooltip-inner {
|
29
29
|
max-width: 300px;
|
30
30
|
}
|
31
|
+
|
32
|
+
input.pacticipant_name {
|
33
|
+
width: 250px;
|
34
|
+
}
|
35
|
+
|
36
|
+
input.tag {
|
37
|
+
width: 250px;
|
38
|
+
}
|
39
|
+
|
40
|
+
img.pact_badge {
|
41
|
+
float: right;
|
42
|
+
margin-top: 15px;
|
43
|
+
}
|
@@ -2,8 +2,10 @@
|
|
2
2
|
"success": true,
|
3
3
|
"providerApplicationVersion": "1.0.0",
|
4
4
|
"testResults": {
|
5
|
-
"
|
5
|
+
"tests": [
|
6
6
|
{
|
7
|
+
"interactionDescription": "a request for something",
|
8
|
+
"interactionProviderState": null,
|
7
9
|
"description": "has status code 200",
|
8
10
|
"file_path": "/redacted/.gem/ruby/2.4.1/gems/pact-1.17.0/lib/pact/provider/rspec.rb",
|
9
11
|
"full_description": "Verifying a pact between me and they Greeting with GET / returns a response which has status code 200",
|
data/script/foo-bar.json
CHANGED
@@ -17,6 +17,17 @@
|
|
17
17
|
"status": 200,
|
18
18
|
"body" : "something"
|
19
19
|
}
|
20
|
+
},{
|
21
|
+
"description" : "a request for something else",
|
22
|
+
"providerState": null,
|
23
|
+
"request": {
|
24
|
+
"method": "get",
|
25
|
+
"path" : "/something"
|
26
|
+
},
|
27
|
+
"response": {
|
28
|
+
"status": 200,
|
29
|
+
"body" : "something"
|
30
|
+
}
|
20
31
|
}
|
21
32
|
]
|
22
33
|
}
|
data/script/seed.rb
CHANGED
@@ -59,7 +59,7 @@ TestDataBuilder.new
|
|
59
59
|
body: webhook_body.to_json)
|
60
60
|
.set_now(Date.today - 101)
|
61
61
|
.tap{ | it |
|
62
|
-
|
62
|
+
2.times do | i |
|
63
63
|
it.create_pact_with_verification("Foo", i.to_s, "Bar", i.to_s)
|
64
64
|
.create_pact_with_verification("Bar", i.to_s, "Foo", i.to_s)
|
65
65
|
.add_day
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe "Deleting
|
1
|
+
describe "Deleting an integration" do
|
2
2
|
|
3
3
|
let(:path) { "/integrations/provider/Bar/consumer/Foo" }
|
4
4
|
|
@@ -19,7 +19,7 @@ describe "Deleting pact versions" do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
context "when the
|
22
|
+
context "when the integration does not exist" do
|
23
23
|
it "returns a 404 Not Found" do
|
24
24
|
expect(subject.status).to be 404
|
25
25
|
end
|
@@ -37,4 +37,13 @@ describe "get latest matrix badge with tags" do
|
|
37
37
|
it "returns an svg body" do
|
38
38
|
expect(subject.body).to include "<svg/>"
|
39
39
|
end
|
40
|
+
|
41
|
+
context "when one of the pacticipants does not exist" do
|
42
|
+
let(:path) { "/matrix/provider/provider/latest/master/consumer/consumer2/latest/prod/badge" }
|
43
|
+
|
44
|
+
it "returns a 200 status as the badge content indicated the pact is not found" do
|
45
|
+
expect(subject.status).to eq 200
|
46
|
+
expect(subject.body).to include "not found"
|
47
|
+
end
|
48
|
+
end
|
40
49
|
end
|
@@ -32,5 +32,21 @@ describe "UI index" do
|
|
32
32
|
expect(subject.body.scan('<tr').to_a.count).to eq 3
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
context "with the base_url not set" do
|
37
|
+
it "returns relative links" do
|
38
|
+
expect(subject.body).to include "href='/stylesheets"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "with the base_url set" do
|
43
|
+
before do
|
44
|
+
allow(PactBroker.configuration).to receive(:base_url).and_return('http://example.org/pact-broker')
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns absolute links" do
|
48
|
+
expect(subject.body).to include "href='http://example.org/pact-broker/stylesheets"
|
49
|
+
end
|
50
|
+
end
|
35
51
|
end
|
36
52
|
end
|