From 48eccdb9185dba674f6574108d45e32466148c88 Mon Sep 17 00:00:00 2001 From: Mooktakim Ahmed Date: Wed, 25 Sep 2024 16:36:48 +0100 Subject: [PATCH] [CPDLP-3510] Missed one ecf api disabled test --- app/services/funding_eligibility.rb | 16 ++++++++++------ .../lib/services/ecf/npq_profile_updater_spec.rb | 6 +++++- spec/lib/services/funding_eligibility_spec.rb | 14 ++++++++------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/app/services/funding_eligibility.rb b/app/services/funding_eligibility.rb index 6956cb11fe..fcafd4b928 100644 --- a/app/services/funding_eligibility.rb +++ b/app/services/funding_eligibility.rb @@ -151,9 +151,11 @@ def possible_funding_for_non_pp50_and_fe? end def previously_received_targeted_funding_support? - return ecf_api_funding_lookup["previously_received_targeted_funding_support"] == true unless Feature.ecf_api_disabled? - - accepted_applications.with_targeted_delivery_funding_eligibility.any? + if Feature.ecf_api_disabled? + accepted_applications.with_targeted_delivery_funding_eligibility.any? + else + ecf_api_funding_lookup["previously_received_targeted_funding_support"] == true + end end def ineligible_institution_type? @@ -212,9 +214,11 @@ def trn_users end def previously_funded? - return ecf_api_funding_lookup["previously_funded"] == true unless Feature.ecf_api_disabled? - - accepted_applications.any? + if Feature.ecf_api_disabled? + accepted_applications.any? + else + ecf_api_funding_lookup["previously_funded"] == true + end end def accepted_applications diff --git a/spec/lib/services/ecf/npq_profile_updater_spec.rb b/spec/lib/services/ecf/npq_profile_updater_spec.rb index 5dc63269d9..e357a22d42 100644 --- a/spec/lib/services/ecf/npq_profile_updater_spec.rb +++ b/spec/lib/services/ecf/npq_profile_updater_spec.rb @@ -125,8 +125,12 @@ context "when ecf_api_disabled flag is toggled on" do before { allow(Feature).to receive(:ecf_api_disabled?).and_return(true) } - it "returns nil" do + it ".call returns nil" do expect(subject.call).to be_nil end + + it ".tsf_data_field_update returns nil" do + expect(subject.tsf_data_field_update).to be_nil + end end end diff --git a/spec/lib/services/funding_eligibility_spec.rb b/spec/lib/services/funding_eligibility_spec.rb index 85896670af..50317f0a9c 100644 --- a/spec/lib/services/funding_eligibility_spec.rb +++ b/spec/lib/services/funding_eligibility_spec.rb @@ -27,12 +27,14 @@ let(:query_store) { nil } before do - mock_previous_funding_api_request( - course_identifier:, - get_an_identity_id:, - trn:, - response: ecf_funding_lookup_response(previously_funded:), - ) + unless Feature.ecf_api_disabled? + mock_previous_funding_api_request( + course_identifier:, + get_an_identity_id:, + trn:, + response: ecf_funding_lookup_response(previously_funded:), + ) + end end describe ".funded? && .funding_eligiblity_status_code" do