From 11a56b5c3214dec2a26c70bdd61f36d8a5ab2910 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 14 Aug 2018 08:32:41 +1000 Subject: [PATCH] feat: renamed 'wip pacts' to 'pending pacts' --- lib/pact_broker/api.rb | 4 ++-- lib/pact_broker/api/resources/index.rb | 6 +++--- ...provider_pacts.rb => pending_provider_pacts.rb} | 6 +++--- .../doc/views/pending-provider-pacts.markdown | 3 +++ .../doc/views/wip-provider-pacts.markdown | 3 --- lib/pact_broker/pacts/repository.rb | 2 +- lib/pact_broker/pacts/service.rb | 4 ++-- spec/features/get_wip_provider_pacts_spec.rb | 4 ++-- ...acts_spec.rb => pending_provider_pacts_spec.rb} | 14 +++++++------- ...ory_find_wip_pact_versions_for_provider_spec.rb | 4 ++-- .../provider_states_for_pact_ruby.rb | 4 ++-- 11 files changed, 27 insertions(+), 27 deletions(-) rename lib/pact_broker/api/resources/{wip_provider_pacts.rb => pending_provider_pacts.rb} (62%) create mode 100644 lib/pact_broker/doc/views/pending-provider-pacts.markdown delete mode 100644 lib/pact_broker/doc/views/wip-provider-pacts.markdown rename spec/lib/pact_broker/api/resources/{wip_provider_pacts_spec.rb => pending_provider_pacts_spec.rb} (54%) diff --git a/lib/pact_broker/api.rb b/lib/pact_broker/api.rb index a0b4b0c1b..c628aab2a 100644 --- a/lib/pact_broker/api.rb +++ b/lib/pact_broker/api.rb @@ -41,8 +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"} - # WIP pacts - add ['pacts', 'provider', :provider_name, 'wip'], Api::Resources::WipProviderPacts, {resource_name: "wip_provider_pact_publications"} + # Pending pacts + add ['pacts', 'provider', :provider_name, 'pending'], Api::Resources::PendingProviderPacts, {resource_name: "pending_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 cddf409d1..25184c6e2 100644 --- a/lib/pact_broker/api/resources/index.rb +++ b/lib/pact_broker/api/resources/index.rb @@ -83,10 +83,10 @@ def links title: 'Webhooks', templated: false }, - 'beta:wip-provider-pacts' => + 'beta:pending-provider-pacts' => { - href: base_url + '/pacts/provider/{provider}/wip', - title: 'WIP pact versions for the specified provider', + href: base_url + '/pacts/provider/{provider}/pending', + title: 'Pending pact versions for the specified provider', templated: true }, 'curies' => diff --git a/lib/pact_broker/api/resources/wip_provider_pacts.rb b/lib/pact_broker/api/resources/pending_provider_pacts.rb similarity index 62% rename from lib/pact_broker/api/resources/wip_provider_pacts.rb rename to lib/pact_broker/api/resources/pending_provider_pacts.rb index eb8494e3d..0edfae11d 100644 --- a/lib/pact_broker/api/resources/wip_provider_pacts.rb +++ b/lib/pact_broker/api/resources/pending_provider_pacts.rb @@ -5,15 +5,15 @@ module PactBroker module Api module Resources - class WipProviderPacts < ProviderPacts + class PendingProviderPacts < ProviderPacts private def pacts - pact_service.find_wip_pact_versions_for_provider provider_name + pact_service.find_pending_pact_versions_for_provider provider_name end def resource_title - "WIP pact versions for the provider #{provider_name}" + "Pending pact versions for the provider #{provider_name}" end end end diff --git a/lib/pact_broker/doc/views/pending-provider-pacts.markdown b/lib/pact_broker/doc/views/pending-provider-pacts.markdown new file mode 100644 index 000000000..c08471bff --- /dev/null +++ b/lib/pact_broker/doc/views/pending-provider-pacts.markdown @@ -0,0 +1,3 @@ +# Pending Pacts + +This feature is in beta. It allows pending 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/lib/pact_broker/doc/views/wip-provider-pacts.markdown b/lib/pact_broker/doc/views/wip-provider-pacts.markdown deleted file mode 100644 index aa8df5b93..000000000 --- a/lib/pact_broker/doc/views/wip-provider-pacts.markdown +++ /dev/null @@ -1,3 +0,0 @@ -# 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/lib/pact_broker/pacts/repository.rb b/lib/pact_broker/pacts/repository.rb index 71ef54fb8..88cf2906c 100644 --- a/lib/pact_broker/pacts/repository.rb +++ b/lib/pact_broker/pacts/repository.rb @@ -92,7 +92,7 @@ def find_latest_pact_versions_for_provider provider_name, tag = nil end end - def find_wip_pact_versions_for_provider provider_name + def find_pending_pact_versions_for_provider provider_name provider_id = pacticipant_repository.find_by_name(provider_name).id pact_publication_ids = PactBroker::Matrix::HeadRow.where(provider_id: provider_id).exclude(success: true).select_for_subquery(:pact_publication_id) AllPactPublications.where(id: pact_publication_ids).order_ignore_case(:consumer_name).order_append(:consumer_version_order).collect(&:to_domain) diff --git a/lib/pact_broker/pacts/service.rb b/lib/pact_broker/pacts/service.rb index e9d57347c..a1fbe308e 100644 --- a/lib/pact_broker/pacts/service.rb +++ b/lib/pact_broker/pacts/service.rb @@ -72,8 +72,8 @@ def find_latest_pact_versions_for_provider provider_name, options = {} pact_repository.find_latest_pact_versions_for_provider provider_name, options[:tag] end - def find_wip_pact_versions_for_provider provider_name - pact_repository.find_wip_pact_versions_for_provider provider_name + def find_pending_pact_versions_for_provider provider_name + pact_repository.find_pending_pact_versions_for_provider provider_name end def find_pact_versions_for_provider provider_name, options = {} diff --git a/spec/features/get_wip_provider_pacts_spec.rb b/spec/features/get_wip_provider_pacts_spec.rb index 37c8cf876..b1a1824ed 100644 --- a/spec/features/get_wip_provider_pacts_spec.rb +++ b/spec/features/get_wip_provider_pacts_spec.rb @@ -1,4 +1,4 @@ -describe "Get WIP provider pacts" do +describe "Get pending provider pacts" do subject { get path; last_response } let(:last_response_body) { JSON.parse(subject.body, symbolize_names: true) } @@ -13,7 +13,7 @@ .create_pact end - let(:path) { "/pacts/provider/Provider/wip" } + let(:path) { "/pacts/provider/Provider/pending" } it "returns a 200 HAL JSON response" do expect(subject).to be_a_hal_json_success_response diff --git a/spec/lib/pact_broker/api/resources/wip_provider_pacts_spec.rb b/spec/lib/pact_broker/api/resources/pending_provider_pacts_spec.rb similarity index 54% rename from spec/lib/pact_broker/api/resources/wip_provider_pacts_spec.rb rename to spec/lib/pact_broker/api/resources/pending_provider_pacts_spec.rb index 7d0719d59..b40b578c9 100644 --- a/spec/lib/pact_broker/api/resources/wip_provider_pacts_spec.rb +++ b/spec/lib/pact_broker/api/resources/pending_provider_pacts_spec.rb @@ -3,28 +3,28 @@ module PactBroker module Api module Resources - describe WipProviderPacts do + describe PendingProviderPacts do before do - allow(PactBroker::Pacts::Service).to receive(:find_wip_pact_versions_for_provider).and_return(pacts) + allow(PactBroker::Pacts::Service).to receive(:find_pending_pact_versions_for_provider).and_return(pacts) allow(PactBroker::Api::Decorators::ProviderPactsDecorator).to receive(:new).and_return(decorator) - allow_any_instance_of(WipProviderPacts).to receive(:resource_exists?).and_return(provider) + allow_any_instance_of(PendingProviderPacts).to receive(:resource_exists?).and_return(provider) end let(:provider) { double('provider') } let(:pacts) { double('pacts') } - let(:path) { '/pacts/provider/Bar/wip' } + let(:path) { '/pacts/provider/Bar/pending' } let(:decorator) { instance_double('PactBroker::Api::Decorators::ProviderPactsDecorator') } subject { get path; last_response } - it "finds the wip pacts for the provider" do - expect(PactBroker::Pacts::Service).to receive(:find_wip_pact_versions_for_provider).with("Bar") + it "finds the pending pacts for the provider" do + expect(PactBroker::Pacts::Service).to receive(:find_pending_pact_versions_for_provider).with("Bar") subject end it "sets the correct resource title" do expect(decorator).to receive(:to_json) do | options | - expect(options[:user_options][:title]).to eq "WIP pact versions for the provider Bar" + expect(options[:user_options][:title]).to eq "Pending pact versions for the provider Bar" end subject end diff --git a/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb b/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb index 0939094be..a79b3f8d5 100644 --- a/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb +++ b/spec/lib/pact_broker/pacts/repository_find_wip_pact_versions_for_provider_spec.rb @@ -5,8 +5,8 @@ module Pacts describe Repository do let(:td) { TestDataBuilder.new } - describe "find_wip_pact_versions_for_provider" do - subject { Repository.new.find_wip_pact_versions_for_provider("bar") } + describe "find_pending_pact_versions_for_provider" do + subject { Repository.new.find_pending_pact_versions_for_provider("bar") } context "when the latest pact for a tag has been successfully verified" do before do diff --git a/spec/service_consumers/provider_states_for_pact_ruby.rb b/spec/service_consumers/provider_states_for_pact_ruby.rb index 8722594a3..3b6c4da9d 100644 --- a/spec/service_consumers/provider_states_for_pact_ruby.rb +++ b/spec/service_consumers/provider_states_for_pact_ruby.rb @@ -6,11 +6,11 @@ no_op end - provider_state "the relation for retrieving WIP pacts exists in the index resource" do + provider_state "the relation for retrieving pending pacts exists in the index resource" do no_op end - provider_state "consumer-1 has a WIP pact with provider provider-1" do + provider_state "consumer-1 has a pending pact with provider provider-1" do set_up do TestDataBuilder.new .create_provider('provider-1')