-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing signup/sektion family member email validation (#856)
- Loading branch information
1 parent
6ee6bf8
commit d8396a3
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,32 @@ def build(params = required_attrs) | |
] | ||
end | ||
|
||
it "is invalid when on family_fields step and resuses main person email" do | ||
@current_step = 2 | ||
required_attrs[:family_fields] = { | ||
members_attributes: [ | ||
[0, {first_name: "Maxine", last_name: "Muster", birthday: "1.1.2000", email: "[email protected]"}] | ||
] | ||
} | ||
expect(wizard).not_to be_valid | ||
expect(wizard.errors).to be_empty | ||
expect(wizard.family_fields).not_to be_valid | ||
expect(wizard.family_fields.members.first.errors.full_messages).to eq ["E-Mail (optional) ist bereits vergeben. Die E-Mail muss eindeutig sein pro Person."] | ||
end | ||
|
||
it "is invalid when on family_fields step and uses existing email" do | ||
@current_step = 2 | ||
required_attrs[:family_fields] = { | ||
members_attributes: [ | ||
[0, {first_name: "Maxine", last_name: "Muster", birthday: "1.1.2000", email: "[email protected]"}] | ||
] | ||
} | ||
expect(wizard).not_to be_valid | ||
expect(wizard.errors).to be_empty | ||
expect(wizard.family_fields).not_to be_valid | ||
expect(wizard.family_fields.members.first.errors.full_messages).to eq ["E-Mail (optional) ist bereits vergeben. Die E-Mail muss eindeutig sein pro Person."] | ||
end | ||
|
||
it "is invalid when on various_fields step and data_protection is blank" do | ||
@current_step = 3 | ||
required_attrs[:various_fields] = {data_protection: nil} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,15 @@ | |
expect(form.errors.full_messages).to eq ["In einer Familienmitgliedschaft sind maximal 2 Erwachsene inbegriffen."] | ||
end | ||
|
||
it "is invalid if second member reuses existing email" do | ||
form.members_attributes = [ | ||
[0, required_attrs.merge(email: "[email protected]")], | ||
[1, required_attrs.merge(email: "[email protected]", birthday: "1.10.2014")] | ||
] | ||
expect(form).not_to be_valid | ||
expect(form.members.second.errors.full_messages).to eq ["E-Mail (optional) ist bereits vergeben. Die E-Mail muss eindeutig sein pro Person."] | ||
end | ||
|
||
it "is invalid if second member reuses main_email in members" do | ||
form.members_attributes = [ | ||
[0, required_attrs.merge(email: "[email protected]")], | ||
|