adds specs
This commit is contained in:
@@ -32,6 +32,26 @@ feature 'Residence' do
|
|||||||
expect(page).to have_content /\d errors? prevented your residence verification/
|
expect(page).to have_content /\d errors? prevented your residence verification/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario 'Error on postal code not in Madrid census' do
|
||||||
|
user = create(:user)
|
||||||
|
login_as(user)
|
||||||
|
|
||||||
|
visit account_path
|
||||||
|
click_link 'Verify my account'
|
||||||
|
|
||||||
|
fill_in 'residence_document_number', with: "12345678Z"
|
||||||
|
select 'Spanish ID', from: 'residence_document_type'
|
||||||
|
select '1997', from: 'residence_date_of_birth_1i'
|
||||||
|
select 'January', from: 'residence_date_of_birth_2i'
|
||||||
|
select '1', from: 'residence_date_of_birth_3i'
|
||||||
|
fill_in 'residence_postal_code', with: '12345'
|
||||||
|
check 'residence_terms_of_service'
|
||||||
|
|
||||||
|
click_button 'Verify residence'
|
||||||
|
|
||||||
|
expect(page).to have_content 'Please, to verify your account you need to be in the census of the Madrid town.'
|
||||||
|
end
|
||||||
|
|
||||||
scenario 'Error on Madrid census' do
|
scenario 'Error on Madrid census' do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
login_as(user)
|
login_as(user)
|
||||||
|
|||||||
@@ -29,6 +29,25 @@ describe Verification::Residence do
|
|||||||
expect(residence.errors[:date_of_birth]).to include("You need yo be at least 16 years old")
|
expect(residence.errors[:date_of_birth]).to include("You need yo be at least 16 years old")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "postal code" do
|
||||||
|
it "should be valid with postal codes starting with 280" do
|
||||||
|
residence.postal_code = "28012"
|
||||||
|
expect(residence.errors[:postal_code].size).to eq(0)
|
||||||
|
|
||||||
|
residence.postal_code = "28023"
|
||||||
|
expect(residence.errors[:postal_code].size).to eq(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should not be valid with postal codes not starting with 280" do
|
||||||
|
residence.postal_code = "12345"
|
||||||
|
expect(residence.errors[:postal_code].size).to eq(1)
|
||||||
|
|
||||||
|
residence.postal_code = "13280"
|
||||||
|
expect(residence.errors[:postal_code].size).to eq(1)
|
||||||
|
expect(residence.errors[:postal_code]).to include("Please, to verify your account you need to be in the census of the Madrid town.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "should validate uniquness of document_number" do
|
it "should validate uniquness of document_number" do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
residence.user = user
|
residence.user = user
|
||||||
|
|||||||
Reference in New Issue
Block a user