Skip to content

Commit b1ec762

Browse files
authored
[WRSAT-502] Edu-Work-History Trigger Logic Fix (#210)
1 parent 9e5744b commit b1ec762

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

app/controllers/nc/edu_work_history_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def self.attributes_edited
1010
end
1111

1212
def self.show?(screener)
13-
screener.state == LocationData::States::NORTH_CAROLINA
13+
screener.state == LocationData::States::NORTH_CAROLINA && screener.age.to_i >= 55
1414
end
1515

1616
def self.load_model(intake, item_index: nil)

spec/controllers/nc/edu_work_history_controller_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,30 @@
2424
expect(screener.nc_screener.worked_last_five_years).to eq "yes"
2525
end
2626
end
27+
28+
describe ".show?" do
29+
context "screener with NC" do
30+
it "returns false" do
31+
screener = create(:screener, state: "NC", birth_date: 30.years.ago.to_date)
32+
expect(subject.class.show?(screener)).to eq false
33+
end
34+
35+
it "returns true" do
36+
screener = create(:screener, state: "NC", birth_date: 55.years.ago.to_date)
37+
expect(subject.class.show?(screener)).to eq true
38+
end
39+
end
40+
41+
context "screener with !NC" do
42+
it "returns false" do
43+
screener = create(:screener, state: "TX", birth_date: 30.years.ago.to_date)
44+
expect(subject.class.show?(screener)).to eq false
45+
end
46+
47+
it "returns false" do
48+
screener = create(:screener, state: "TX", birth_date: 55.years.ago.to_date)
49+
expect(subject.class.show?(screener)).to eq false
50+
end
51+
end
52+
end
2753
end

spec/features/flow_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
expect(page).to have_selector("h1", text: I18n.t("views.date_of_birth.edit.title"))
1818
select "September", from: "Month"
1919
select "21", from: "Day"
20-
select "2000", from: "Year"
20+
select "1965", from: "Year"
2121
click_on I18n.t("general.continue")
2222

2323
expect(page).to have_selector("h1", text: I18n.t("views.tribe_or_nation.edit.title"))

0 commit comments

Comments
 (0)