Skip to content

Commit

Permalink
[CPDLP-3510] Missed one ecf api disabled test
Browse files Browse the repository at this point in the history
  • Loading branch information
mooktakim committed Sep 25, 2024
1 parent d7d25de commit 48eccdb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
16 changes: 10 additions & 6 deletions app/services/funding_eligibility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion spec/lib/services/ecf/npq_profile_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 8 additions & 6 deletions spec/lib/services/funding_eligibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 48eccdb

Please sign in to comment.