diff --git a/lib/pact_broker/api.rb b/lib/pact_broker/api.rb index 00744f349..a0b4b0c1b 100644 --- a/lib/pact_broker/api.rb +++ b/lib/pact_broker/api.rb @@ -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 diff --git a/lib/pact_broker/api/resources/index.rb b/lib/pact_broker/api/resources/index.rb index fbb8df222..cddf409d1 100644 --- a/lib/pact_broker/api/resources/index.rb +++ b/lib/pact_broker/api/resources/index.rb @@ -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', @@ -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 diff --git a/lib/pact_broker/doc/views/wip-provider-pacts.markdown b/lib/pact_broker/doc/views/wip-provider-pacts.markdown new file mode 100644 index 000000000..aa8df5b93 --- /dev/null +++ b/lib/pact_broker/doc/views/wip-provider-pacts.markdown @@ -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. \ No newline at end of file diff --git a/spec/service_consumers/provider_states_for_pact_ruby.rb b/spec/service_consumers/provider_states_for_pact_ruby.rb index 104fb91cd..8722594a3 100644 --- a/spec/service_consumers/provider_states_for_pact_ruby.rb +++ b/spec/service_consumers/provider_states_for_pact_ruby.rb @@ -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