|
36 | 36 | user.update_attributes last_request_at: 1.day.ago
|
37 | 37 | expect(user.achievements_unlocked_since_last_visit.count).to eq(1)
|
38 | 38 |
|
39 |
| - email = NotifierMailer.new_badge(user.reload.username) |
| 39 | + email = NotifierMailer.new_badge(user.reload.username).deliver_now |
40 | 40 | check_badge_message(email, badge)
|
41 |
| - expect(email.body.encoded).to include(user_achievement_url(username: user.username, id: badge.id, host: 'coderwall.com')) |
| 41 | + expect(email.body.encoded).to include(user_achievement_url(username: user.username, id: badge.id, host: 'www.coderwall.com')) |
42 | 42 | end
|
43 | 43 |
|
44 | 44 | it 'should send one achievement email at a time until user visits' do
|
|
48 | 48 | user.update_attributes last_request_at: 1.day.ago
|
49 | 49 |
|
50 | 50 | expect(user.achievements_unlocked_since_last_visit.count).to eq(3)
|
51 |
| - email = NotifierMailer.new_badge(user.reload.username) |
| 51 | + email = NotifierMailer.new_badge(user.reload.username).deliver_now |
52 | 52 | check_badge_message(email, badge1)
|
53 | 53 | expect(user.achievements_unlocked_since_last_visit.count).to eq(3)
|
54 |
| - email = NotifierMailer.new_badge(user.reload.username) |
| 54 | + email = NotifierMailer.new_badge(user.reload.username).deliver_now |
55 | 55 | check_badge_message(email, badge2)
|
56 | 56 | user.last_request_at = Time.now + 3.second
|
57 | 57 | user.save
|
58 | 58 | expect(user.achievements_unlocked_since_last_visit.count).to eq(0)
|
59 |
| - expect { NotifierMailer.new_badge(user.reload.username) }.to raise_error(NotifierMailer::NothingToSendException) |
| 59 | + expect { NotifierMailer.new_badge(user.reload.username).deliver_now }.to raise_error(NotifierMailer::NothingToSendException) |
60 | 60 | end
|
61 | 61 |
|
62 | 62 | def check_badge_message(email, badge)
|
|
0 commit comments