Extract component to render the date of birth
We reduce code duplication thanks to that, and make it easier to change this field. Note that there was one place where the "16.years" value was hardcoded. We're moving the test for this case to the component and changing it so the test doesn't use the default age. We're also removing the redundant helper method that had the same code as a method in the User class which is called everywhere else.
This commit is contained in:
@@ -38,21 +38,6 @@ describe "Residence" do
|
||||
expect(page).to have_content "Residence verified"
|
||||
end
|
||||
|
||||
scenario "Residence form use min age to participate" do
|
||||
min_age = (Setting["min_age_to_participate"] = 16).to_i
|
||||
underage = min_age - 1
|
||||
user = create(:user)
|
||||
login_as(user)
|
||||
|
||||
visit account_path
|
||||
click_link "Verify my account"
|
||||
|
||||
expect(page).to have_select("residence_date_of_birth_1i",
|
||||
with_options: [min_age.years.ago.year])
|
||||
expect(page).not_to have_select("residence_date_of_birth_1i",
|
||||
with_options: [underage.years.ago.year])
|
||||
end
|
||||
|
||||
scenario "When trying to verify a deregistered account old votes are reassigned" do
|
||||
erased_user = create(:user, document_number: "12345678Z", document_type: "1", erased_at: Time.current)
|
||||
vote = create(:vote, voter: erased_user)
|
||||
|
||||
Reference in New Issue
Block a user