From 9430bba2e19439c61647bbf73c96b1b52ea8fb5a Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 13 Dec 2018 07:00:30 +0500 Subject: [PATCH] Add more specs --- features/desktop/password_change.feature | 1 + features/step_definitions/user.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/features/desktop/password_change.feature b/features/desktop/password_change.feature index 605de6c..e74e3a0 100644 --- a/features/desktop/password_change.feature +++ b/features/desktop/password_change.feature @@ -9,6 +9,7 @@ Feature: Password change | Текущий пароль | password | And I click the form button "Обновить" Then the password is successfully changed + And I received password change email as "user@example.com" When I try to sign out Then I am successfully signed out diff --git a/features/step_definitions/user.rb b/features/step_definitions/user.rb index 28f8f6c..39a64da 100644 --- a/features/step_definitions/user.rb +++ b/features/step_definitions/user.rb @@ -107,6 +107,18 @@ Then 'I received confirmation email as {string}' do |email| TEXT end +Then 'I received password change email as {string}' do |email| + mail = ActionMailer::Base.deliveries.last + + expect(mail.from).to eq %w[no-reply@libertarian-party.com] + expect(mail.to).to eq [email] + expect(mail.subject).to eq 'Пароль изменен' + expect(mail.body.to_s.split.join(' ')).to eq <<~TEXT.split("\n").join(' ') +

Приветствуем, #{email}!

+

Мы пытаемся связаться с вами, что бы сообщить, что ваш пароль был изменен.

+ TEXT +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',