1
0
Fork 0
This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/features/step_definitions/user_mail.rb

30 lines
1.3 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
Then 'I received confirmation email as {string}' do |email|
mail = ActionMailer::Base.deliveries.last
token = User.find_by!(email: email).confirmation_token
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(' ')
<p>Здравствуйте, #{email} !</p>
<p>Вы можете активировать свою учетную запись, нажав ссылку снизу:</p>
<p>
<a href="http://localhost:3000/users/confirmation?confirmation_token=#{token}">Активировать</a>
</p>
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(' ')
<p>Приветствуем, #{email}!</p>
<p>Мы пытаемся связаться с вами, что бы сообщить, что ваш пароль был изменен.</p>
TEXT
end