From 300e2132582660b2a5f721e6a9e5bd1260e125fd Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 13 Dec 2018 06:32:57 +0500 Subject: [PATCH] Add more specs --- features/desktop/sign_up.feature | 6 ++++++ features/step_definitions/sign_up.rb | 11 +++++++++++ 2 files changed, 17 insertions(+) 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