Skip to content

Commit cb90ba2

Browse files
Update specs to expect custom validation messages
Existing specs were asserting Rails default messages like "can't be blank" and "is not included in the list". Now that custom I18n messages are in place, update these assertions to match.
1 parent f9e8511 commit cb90ba2

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

spec/features/cli_teams_onboard_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def and_schools_are_added_to_the_team_appropriately
179179
end
180180

181181
def then_i_see_an_error_message
182-
expect(@output).to include("Programmes can't be blank")
182+
expect(@output).to include("Programmes Choose at least one programme")
183183
expect(@output).to include(
184184
"Schools URN(s) 456789 cannot appear as both a regular school and a site"
185185
)

spec/models/draft_vaccination_record_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@
417417
it "has an error" do
418418
expect(draft_vaccination_record.save(context: :update)).to be(false)
419419
expect(draft_vaccination_record.errors[:source]).to include(
420-
"is not included in the list"
420+
"Choose a source"
421421
)
422422
end
423423
end
@@ -430,7 +430,7 @@
430430
it "is invalid" do
431431
expect(draft_vaccination_record.save(context: :update)).to be(false)
432432
expect(draft_vaccination_record.errors[:source]).to include(
433-
"is not included in the list"
433+
"Choose a source"
434434
)
435435
end
436436
end

spec/models/onboarding_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@
150150

151151
expect(onboarding.errors.messages).to eq(
152152
{
153-
"team.name": ["can't be blank"],
154-
"team.type": ["is not included in the list"],
155-
"team.workgroup": ["can't be blank"],
153+
"team.name": ["Enter a name"],
154+
"team.type": ["Choose a type"],
155+
"team.workgroup": ["Enter a workgroup"],
156156
"school.0.subteam": ["can't be blank"],
157157
"school.1.subteam": ["can't be blank"],
158158
"school.5.urn": [
@@ -168,9 +168,9 @@
168168
"URN(s) 456789 cannot appear as both a regular school and a site"
169169
],
170170
"subteam.email": ["can't be blank"],
171-
"subteam.name": ["can't be blank"],
172-
clinics: ["can't be blank"],
173-
programmes: ["can't be blank"]
171+
"subteam.name": ["Enter a name"],
172+
clinics: ["Choose at least one clinic"],
173+
programmes: ["Choose at least one programme"]
174174
}
175175
)
176176
end

spec/requests/api/testing/onboard_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565

6666
expect(errors).to eq(
6767
{
68-
"clinics" => ["can't be blank"],
69-
"organisation.ods_code" => ["can't be blank"],
70-
"team.name" => ["can't be blank"],
71-
"team.type" => ["is not included in the list"],
72-
"team.workgroup" => ["can't be blank"],
73-
"programmes" => ["can't be blank"],
68+
"clinics" => ["Choose at least one clinic"],
69+
"organisation.ods_code" => ["Enter an ODS code"],
70+
"team.name" => ["Enter a name"],
71+
"team.type" => ["Choose a type"],
72+
"team.workgroup" => ["Enter a workgroup"],
73+
"programmes" => ["Choose at least one programme"],
7474
"school.0.location" => ["can't be blank"],
7575
"school.0.status" => ["is not included in the list"],
7676
"school.0.subteam" => ["can't be blank"],
@@ -93,7 +93,7 @@
9393
"URN(s) 456789 cannot appear as both a regular school and a site"
9494
],
9595
"subteam.email" => ["can't be blank"],
96-
"subteam.name" => ["can't be blank"]
96+
"subteam.name" => ["Enter a name"]
9797
}
9898
)
9999
end

0 commit comments

Comments
 (0)