Skip to content

Commit

Permalink
ap-5338: add placeholder for autogranted logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kmahern committed Nov 7, 2024
1 parent 0d456b3 commit b15c21d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/legal_aid_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,11 @@ def child_subject?
proceedings.any? { |proceeding| proceeding.relationship_to_child.eql?("child_subject") }
end

def auto_grant_special_children_act?(_options)
# TODO: extract autogrant logic into model
false
end

private

def expired_by_2023_surname_at_birth_issue?
Expand Down
6 changes: 6 additions & 0 deletions app/services/reports/mis/application_detail_csv_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def self.header_row
"Biological parent relationship?",
"Parental responsibility order relationship?",
"Child subject relationship?",
"Autogranted?",
]
end

Expand Down Expand Up @@ -215,6 +216,7 @@ def call
previous_ccms_ref
child_client_involvement_type
sca
autogranted
sanitise
end

Expand Down Expand Up @@ -476,6 +478,10 @@ def sca
end
end

def autogranted
@line << yesno(laa.auto_grant_special_children_act?(nil))
end

def yesno(value)
value == true ? "Yes" : "No"
end
Expand Down
18 changes: 18 additions & 0 deletions spec/services/reports/mis/application_detail_csv_line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,24 @@ module MIS
end
end

describe "autogranted" do
context "when the application is autogranted" do
before { allow(legal_aid_application).to receive(:auto_grant_special_children_act?).and_return(true) }

it "sets autogranted? to Yes" do
expect(value_for("Autogranted?")).to eq "Yes"
end
end

context "when the application is not autogranted" do
before { allow(legal_aid_application).to receive(:auto_grant_special_children_act?).and_return(false) }

it "sets autogranted? to Yes" do
expect(value_for("Autogranted?")).to eq "No"
end
end
end

context "when the applicant age cannot be generated" do
let(:legal_aid_application) { create(:legal_aid_application, applicant:) }
let(:applicant) do
Expand Down

0 comments on commit b15c21d

Please sign in to comment.