diff --git a/features/desktop/sign_up.feature b/features/desktop/sign_up.feature index ae33877..1947667 100644 --- a/features/desktop/sign_up.feature +++ b/features/desktop/sign_up.feature @@ -14,3 +14,9 @@ Feature: Sign up When I try to sign in with email "user@example.com" and password "password" Then I fail to sign in because of unconfirmed email + + When I follow confirmation link for email "user@example.com" + Then I see that my email is confirmed + + When I try to sign in with email "user@example.com" and password "password" + Then I am signed in as "user@example.com" diff --git a/features/step_definitions/sign_up.rb b/features/step_definitions/sign_up.rb index 69ec7a9..031611d 100644 --- a/features/step_definitions/sign_up.rb +++ b/features/step_definitions/sign_up.rb @@ -33,3 +33,14 @@ Then 'I fail to sign in because of unconfirmed email' do expect(page).to have_css 'div.alert.alert-warning', text: 'Вы должны подтвердить вашу учетную запись.' end + +When 'I follow confirmation link for email {string}' do |email| + user = User.find_by! email: email + visit user_confirmation_path confirmation_token: user.confirmation_token +end + +Then 'I see that my email is confirmed' do + expect(page.current_path).to eq '/users/sign_in' + expect(page).to have_css 'div.alert.alert-info', + text: 'Ваш адрес эл. почты успешно подтвержден.' +end