From 44a408980b0ac682f460be42b3ca3352cf3a051f Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 10 Sep 2015 11:43:48 +0200 Subject: [PATCH] adds spec for letter verification tries [#332] --- spec/features/verification/letter_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/features/verification/letter_spec.rb b/spec/features/verification/letter_spec.rb index b62ae00f8..eb1392714 100644 --- a/spec/features/verification/letter_spec.rb +++ b/spec/features/verification/letter_spec.rb @@ -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