Skip to content

Commit 398d58c

Browse files
committed
feat: enable publishing provider contracts using the 'all in one' endpoint
Remove feature toggle.
1 parent d99e09d commit 398d58c

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

lib/pactflow/client/provider_contracts/publish.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ def initialize(params, options, pact_broker_client_options)
2626
attr_reader :provider_name, :provider_version_number, :branch_name, :tags, :build_url, :contract, :verification_results
2727

2828
def do_call
29-
if enabled? && index_resource.assert_success!.can?(PUBLISH_RELATION)
29+
if !disabled? && index_resource.assert_success!.can?(PUBLISH_RELATION)
3030
publish_provider_contracts
3131
PactBroker::Client::CommandResult.new(success?, message)
3232
else
3333
PublishTheOldWay.call(params, options, pact_broker_client_options)
3434
end
3535
end
3636

37-
def enabled?
38-
ENV.fetch("PACT_BROKER_FEATURES", "").include?("publish_provider_contracts_all_in_one")
37+
def disabled?
38+
ENV.fetch("PACTFLOW_FEATURES", "").include?("publish_provider_contracts_using_old_api")
3939
end
4040

4141
def publish_provider_contracts

spec/integration/publish_provider_contract_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
require "pactflow/client/cli/pactflow"
22

33
RSpec.describe "publish-provider-contract" do
4-
before do
5-
allow(ENV).to receive(:fetch).and_call_original
6-
allow(ENV).to receive(:fetch).with("PACT_BROKER_FEATURES", "").and_return("publish_provider_contracts_all_in_one")
7-
end
84
let(:index_body_hash) do
95
{
106
_links: {

spec/lib/pactflow/client/provider_contracts/publish_spec.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ module ProviderContracts
77
before do
88
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
99
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:default_max_tries).and_return(1)
10-
allow(ENV).to receive(:fetch).and_call_original
11-
allow(ENV).to receive(:fetch).with("PACT_BROKER_FEATURES", "").and_return("publish_provider_contracts_all_in_one")
1210
end
1311

1412
let(:command_params) do
@@ -99,9 +97,10 @@ module ProviderContracts
9997
end
10098
end
10199

102-
context "when the feature is not enabled" do
100+
context "when the feature is disabled" do
103101
before do
104-
allow(ENV).to receive(:fetch).with("PACT_BROKER_FEATURES", "").and_return("")
102+
allow(ENV).to receive(:fetch).and_call_original
103+
allow(ENV).to receive(:fetch).with("PACTFLOW_FEATURES", "").and_return("publish_provider_contracts_using_old_api")
105104
end
106105

107106
it "publishes the provider contracts the old way" do

spec/service_providers/pactflow_publish_provider_contract_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
before do
77
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
88
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:default_max_tries).and_return(1)
9-
allow(ENV).to receive(:fetch).and_call_original
10-
allow(ENV).to receive(:fetch).with("PACT_BROKER_FEATURES", "").and_return("publish_provider_contracts_all_in_one")
119
end
1210

1311
include_context "pact broker"

0 commit comments

Comments
 (0)