-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3519 from DFE-Digital/CAPT-2081-max-email-address…
…-length CAPT-2081 Lower email address max length to 129
- Loading branch information
Showing
9 changed files
with
87 additions
and
12 deletions.
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
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
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 |
---|---|---|
|
@@ -275,7 +275,7 @@ en: | |
errors: | ||
presence: "Enter an email address" | ||
format: "Enter an email address in the correct format, like [email protected]" | ||
length: "Email address must be 256 characters or less" | ||
length: "Email address must be %{length} characters or less" | ||
mobile_number: | ||
errors: | ||
invalid: "Enter a mobile number, like 07700 900 982 or +44 7700 900 982" | ||
|
@@ -586,7 +586,7 @@ en: | |
email_address: | ||
blank: Enter an email address | ||
invalid: Enter an email address in the correct format, like [email protected] | ||
length: Email address must be 256 characters or less | ||
length: Email address must be %{length} characters or less | ||
unauthorised: Only authorised email addresses can be used when using a team-only API key | ||
check_your_answers: | ||
part_one: | ||
|
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 |
---|---|---|
|
@@ -8,12 +8,13 @@ | |
let(:journey) { Journeys::FurtherEducationPayments } | ||
let(:journey_session) { create(:further_education_payments_session) } | ||
let(:claim) { create(:claim, :submitted) } | ||
let(:params) { ActionController::Parameters.new } | ||
|
||
subject do | ||
described_class.new( | ||
journey_session:, | ||
journey:, | ||
params: ActionController::Parameters.new, | ||
params: params, | ||
session: {"submitted_claim_id" => claim.id} | ||
) | ||
end | ||
|
@@ -40,4 +41,61 @@ | |
end | ||
end | ||
end | ||
|
||
describe "validations" do | ||
let(:domain) { "@example.com" } | ||
|
||
let(:params) do | ||
ActionController::Parameters.new(claim: {reminder_email_address: email_address}) | ||
end | ||
|
||
before do | ||
subject.valid? | ||
end | ||
|
||
describe "email_address" do | ||
context "when missing" do | ||
let(:email_address) { nil } | ||
|
||
it do | ||
expect(subject).not_to be_valid | ||
expect(subject.errors.added?(:reminder_email_address, :blank)).to be true | ||
end | ||
end | ||
|
||
context "when too long" do | ||
let(:email_address) { "#{"a" * (130 - domain.length)}#{domain}" } | ||
|
||
it do | ||
expect(subject).not_to be_valid | ||
expect(subject.errors.added?(:reminder_email_address, :too_long, count: 129)).to be true | ||
expect(subject.errors.messages[:reminder_email_address]).to include("Email address must be 129 characters or less") | ||
end | ||
end | ||
|
||
context "when as long as it can get" do | ||
let(:email_address) { "#{"a" * (129 - domain.length)}#{domain}" } | ||
|
||
it do | ||
expect(subject.errors.added?(:reminder_email_address, :too_long, count: 129)).to be false | ||
end | ||
end | ||
|
||
context "when the wrong format" do | ||
let(:email_address) { "not_an_email" } | ||
|
||
it do | ||
expect(subject.errors.added?(:reminder_email_address, :invalid, value: "not_an_email")).to be true | ||
end | ||
end | ||
|
||
context "when the correct format" do | ||
let(:email_address) { "[email protected]" } | ||
|
||
it do | ||
expect(subject.errors.added?(:reminder_email_address, :invalid, value: "not_an_email")).to be false | ||
end | ||
end | ||
end | ||
end | ||
end |
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