Skip to content

Instantly share code, notes, and snippets.

@mghaught
Created February 10, 2010 17:55
Show Gist options
  • Save mghaught/300611 to your computer and use it in GitHub Desktop.
Save mghaught/300611 to your computer and use it in GitHub Desktop.
... # building up the user, post and topic objects
assert_difference('Delayed::Job.count') do
user.send_forum_notification(:post => post, :topic => topic)
end
assert_emails 1 do
Delayed::Worker.new.work_off
end
notification_email = ActionMailer::Base.deliveries.first
assert_equal "Forum Topic Notification", notification_email.subject
assert_equal user.email, notification_email.to.first
assert_match /#{user.userid},/, notification_email.body
assert_match /The topic, #{topic.title},/, notification_email.body
assert_match /in the #{forum.name} forum/, notification_email.body
assert_match /post from #{topic.user.display_name}\./, notification_email.body
assert_match /#{post.body}/, notification_email.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment