Skip to content

Commit

Permalink
feat: move pb:wip-provider-pacts to beta:wip-provider-pacts
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jul 24, 2018
1 parent f4a03c0 commit 3008140
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
5 changes: 2 additions & 3 deletions lib/pact_broker/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ module PactBroker
add ['pacts', 'provider', :provider_name, 'latest', :tag], Api::Resources::LatestProviderPacts, {resource_name: "latest_tagged_provider_pact_publications"}
add ['pacts', 'latest'], Api::Resources::LatestPacts, {resource_name: "latest_pacts"}

if PactBroker.feature_enabled?(:wip_pacts)
add ['pacts', 'provider', :provider_name, 'wip'], Api::Resources::WipProviderPacts, {resource_name: "wip_provider_pact_publications"}
end
# WIP pacts
add ['pacts', 'provider', :provider_name, 'wip'], Api::Resources::WipProviderPacts, {resource_name: "wip_provider_pact_publications"}

# Deprecated pact
add ['pact', 'provider', :provider_name, 'consumer', :consumer_name, 'version', :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publications", deprecated: "true"} # Deprecate, singular /pact
Expand Down
20 changes: 11 additions & 9 deletions lib/pact_broker/api/resources/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ def links
title: 'All pact versions for the specified provider',
templated: true
},
'pb:wip-provider-pacts' =>
{
href: base_url + '/pacts/provider/{provider}/wip',
title: 'WIP pact versions for the specified provider',
templated: true
},
'pb:latest-version' => {
href: base_url + '/pacticipants/{pacticipant}/latest-version',
title: 'Latest pacticipant version',
Expand All @@ -89,15 +83,23 @@ def links
title: 'Webhooks',
templated: false
},
'beta:wip-provider-pacts' =>
{
href: base_url + '/pacts/provider/{provider}/wip',
title: 'WIP pact versions for the specified provider',
templated: true
},
'curies' =>
[{
name: 'pb',
href: base_url + '/doc/{rel}?context=index',
templated: true
},{
name: 'beta',
href: base_url + '/doc/{rel}?context=index',
templated: true
}]
}.tap do | it |
it.delete('pb:wip-provider-pacts') if ENV['RACK_ENV'] == 'production'
end
}
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/pact_broker/doc/views/wip-provider-pacts.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Work In Progress Pacts

This feature is in beta. It allows WIP pacts (pacts that have not yet been succesfully verified) to run against a provider without failing the build.
14 changes: 14 additions & 0 deletions spec/service_consumers/provider_states_for_pact_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
no_op
end

provider_state "the relation for retrieving WIP pacts exists in the index resource" do
no_op
end

provider_state "consumer-1 has a WIP pact with provider provider-1" do
set_up do
TestDataBuilder.new
.create_provider('provider-1')
.create_consumer('consumer-1')
.create_consumer_version('1.3.0')
.create_pact
end
end

provider_state 'consumer-1 and consumer-2 have pacts with provider provider-1' do
set_up do
TestDataBuilder.new
Expand Down

0 comments on commit 3008140

Please sign in to comment.