adds spec for letter verification tries [#332]

This commit is contained in:
rgarcia
2015-09-10 11:43:48 +02:00
parent 16dd609ad0
commit 44a408980b

View File

@@ -76,4 +76,24 @@ feature 'Verify Letter' do
expect(URI.parse(current_url).path).to eq(new_sms_path)
end
scenario '3 tries allowed' do
user = create(:user, residence_verified_at: Time.now, confirmed_phone: "611111111")
login_as(user)
visit new_letter_path
click_button 'Send me a letter with the code'
3.times do
fill_in 'letter_verification_code', with: "999999"
click_button 'Send'
end
expect(page).to have_content 'You have reached the maximum number of letter verification tries'
expect(URI.parse(current_url).path).to eq(account_path)
visit new_letter_path
expect(page).to have_content 'You have reached the maximum number of letter verification tries'
expect(URI.parse(current_url).path).to eq(account_path)
end
end