Add new and create actions

This commit is contained in:
Senén Rodero Rodríguez
2019-05-08 18:55:31 +02:00
committed by Javi Martín
parent f071ca6cb5
commit fd7cc624db
11 changed files with 131 additions and 0 deletions

View File

@@ -72,4 +72,33 @@ feature "Admin local census records" do
end
end
end
context "Create" do
scenario "Should show validation errors" do
visit new_admin_local_census_record_path
click_on "Save"
expect(page).to have_content "4 errors prevented this Local Census Record from being saved."
expect(page).to have_content "can't be blank", count: 4
end
scenario "Should show successful notice after create valid record" do
visit new_admin_local_census_record_path
fill_in :local_census_record_document_type, with: "DNI"
fill_in :local_census_record_document_number, with: "#DOCUMENT"
select "1982" , from: :local_census_record_date_of_birth_1i
select "July" , from: :local_census_record_date_of_birth_2i
select "7" , from: :local_census_record_date_of_birth_3i
fill_in :local_census_record_postal_code, with: "07003"
click_on "Save"
expect(page).to have_content "New local census record created successfully!"
expect(page).to have_content "DNI"
expect(page).to have_content "#DOCUMENT"
expect(page).to have_content "1982-07-07"
expect(page).to have_content "07003"
end
end
end