refactors specs

This commit is contained in:
rgarcia
2015-08-30 12:51:34 +02:00
parent 0f145da18b
commit 01aa0a5a40
3 changed files with 15 additions and 32 deletions

View File

@@ -14,14 +14,7 @@ feature 'Level three verification' do
visit account_path visit account_path
click_link 'Verify my account' click_link 'Verify my account'
select 'Spanish ID', from: 'residence_document_type' verify_residence
fill_in 'residence_document_number', with: "12345678Z"
select_date '31-December-1980', from: 'residence_date_of_birth'
fill_in 'residence_postal_code', with: '28013'
click_button 'Verify'
expect(page).to have_content 'Residence verified'
within("#verified_user_#{verified_user.id}_phone") do within("#verified_user_#{verified_user.id}_phone") do
click_button "Send" click_button "Send"
@@ -54,14 +47,7 @@ feature 'Level three verification' do
visit account_path visit account_path
click_link 'Verify my account' click_link 'Verify my account'
select 'Spanish ID', from: 'residence_document_type' verify_residence
fill_in 'residence_document_number', with: "12345678Z"
select_date '31-December-1980', from: 'residence_date_of_birth'
fill_in 'residence_postal_code', with: '28013'
click_button 'Verify'
expect(page).to have_content 'Residence verified'
within("#verified_user_#{verified_user.id}_email") do within("#verified_user_#{verified_user.id}_email") do
click_button "Send" click_button "Send"
@@ -86,14 +72,7 @@ feature 'Level three verification' do
visit account_path visit account_path
click_link 'Verify my account' click_link 'Verify my account'
select 'Spanish ID', from: 'residence_document_type' verify_residence
fill_in 'residence_document_number', with: "12345678Z"
select_date '31-December-1980', from: 'residence_date_of_birth'
fill_in 'residence_postal_code', with: '28013'
click_button 'Verify'
expect(page).to have_content 'Residence verified'
fill_in 'sms_phone', with: "611111111" fill_in 'sms_phone', with: "611111111"
click_button 'Send' click_button 'Send'

View File

@@ -9,14 +9,7 @@ feature 'Level two verification' do
visit account_path visit account_path
click_link 'Verify my account' click_link 'Verify my account'
select 'Spanish ID', from: 'residence_document_type' verify_residence
fill_in 'residence_document_number', with: "12345678Z"
select_date '31-December-1980', from: 'residence_date_of_birth'
fill_in 'residence_postal_code', with: '28013'
click_button 'Verify'
expect(page).to have_content 'Residence verified'
fill_in 'sms_phone', with: "611111111" fill_in 'sms_phone', with: "611111111"
click_button 'Send' click_button 'Send'

View File

@@ -97,4 +97,15 @@ module CommonActions
select month, from: "#{selector}_2i" select month, from: "#{selector}_2i"
select year, from: "#{selector}_1i" select year, from: "#{selector}_1i"
end end
def verify_residence
select 'Spanish ID', from: 'residence_document_type'
fill_in 'residence_document_number', with: "12345678Z"
select_date '31-December-1980', from: 'residence_date_of_birth'
fill_in 'residence_postal_code', with: '28013'
check 'residence_terms_of_service'
click_button 'Verify'
expect(page).to have_content 'Residence verified'
end
end end