1
0
Fork 0

Move step definitions to separate file

This commit is contained in:
Alex Kotov 2018-12-13 07:01:10 +05:00
parent 9430bba2e1
commit 01f0785153
No known key found for this signature in database
GPG Key ID: 4E831250F47DE154
2 changed files with 29 additions and 28 deletions

View File

@ -91,34 +91,6 @@ Then 'I am successfully signed up, but my email is unconfirmed' do
)
end
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
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',

View File

@ -0,0 +1,29 @@
# 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