Skip to content

Commit 14f4d88

Browse files
test: that basic validation on DOB is done even when CHILD_YEAR_GROUP is defined
Jira-Issue: MAV-1833
1 parent a7fd947 commit 14f4d88

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spec/models/cohort_import_row_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@
8888
end
8989
end
9090

91+
context "when date of birth is in the previous century" do
92+
let(:data) do
93+
valid_data.merge(
94+
{ "CHILD_DATE_OF_BIRTH" => "1911-01-01", "CHILD_YEAR_GROUP" => "9" }
95+
)
96+
end
97+
98+
it "is invalid" do
99+
expect(cohort_import_row).to be_invalid
100+
puts cohort_import_row.errors.full_messages
101+
expect(cohort_import_row.errors.size).to eq(1)
102+
expect(
103+
cohort_import_row.errors["CHILD_DATE_OF_BIRTH"]
104+
).to contain_exactly("is too old to still be in school")
105+
end
106+
end
107+
91108
context "with an invalid NHS number" do
92109
let(:data) { { "CHILD_NHS_NUMBER" => "TP01234567" } }
93110

0 commit comments

Comments
 (0)