-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathuser_mailer_spec.rb
38 lines (31 loc) · 1.05 KB
/
user_mailer_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'spec_helper'
describe UserMailer do
describe '#login_link' do
subject(:mail) do
described_class.login_link(email, token, locale, label_name, label_link).deliver_now
end
let(:token) { '12345678' }
let(:locale) { :en }
let(:label_name) { 'My RUG' }
let(:label_link) { 'http://rug.org' }
it 'renders the headers' do
expect(mail.subject).to eq('Login to My RUG')
expect(mail.to).to eq([email])
expect(mail.from).to eq([UserMailer::COMMON_SENDER])
end
it 'renders the body' do
link = provider_callback_url(provider: :email,
token:, host: label_link)
expect(mail.body.encoded).to include(link)
expect(mail.body.encoded).to include(label_name)
expect(mail.body.encoded).to include(label_link)
end
context 'when using different locale' do
let(:locale) { :es }
it 'uses the correct locale for the subject' do
expect(mail.subject).to eq('Accede a My RUG')
end
end
end
end