From 43bce745738b56107bd415f890cbf124fb1dc0c8 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Thu, 8 Aug 2024 14:31:51 +0100 Subject: [PATCH] fix: use .empty? in handling_no_pacts_found --- lib/pact/pact_broker/fetch_pact_uris_for_verification.rb | 4 ++-- .../pact/pact_broker/fetch_pact_uris_for_verification_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb b/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb index 1eecad23..dfde9d41 100644 --- a/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb +++ b/lib/pact/pact_broker/fetch_pact_uris_for_verification.rb @@ -101,8 +101,8 @@ def log_message def handling_no_pacts_found pacts_found = yield - raise "No pacts found to verify" if pacts_found.blank? && options[:fail_if_no_pacts_found] != false - if pacts_found.blank? && options[:fail_if_no_pacts_found] == false + raise "No pacts found to verify" if pacts_found.empty? && options[:fail_if_no_pacts_found] != false + if pacts_found.empty? && options[:fail_if_no_pacts_found] == false Pact.configuration.output_stream.puts "WARN: No pacts found to verify & fail_if_no_pacts_found is set to false." end pacts_found diff --git a/spec/lib/pact/pact_broker/fetch_pact_uris_for_verification_spec.rb b/spec/lib/pact/pact_broker/fetch_pact_uris_for_verification_spec.rb index c17800b2..3781ebf3 100644 --- a/spec/lib/pact/pact_broker/fetch_pact_uris_for_verification_spec.rb +++ b/spec/lib/pact/pact_broker/fetch_pact_uris_for_verification_spec.rb @@ -49,7 +49,7 @@ module PactBroker context "when the beta:provider-pacts-for-verification relation does not exist" do before do - allow(FetchPacts).to receive(:call) + allow(FetchPacts).to receive(:call).and_return([]) stub_request(:get, "http://broker.org/").to_return(status: 200, body: response_body, headers: response_headers) end