about summary refs log tree commit diff stats
path: root/test/mailers
diff options
context:
space:
mode:
Diffstat (limited to 'test/mailers')
-rw-r--r--test/mailers/comment_mailer_test.rb7
-rw-r--r--test/mailers/previews/comment_mailer_preview.rb4
-rw-r--r--test/mailers/previews/vote_mailer_preview.rb11
-rw-r--r--test/mailers/vote_mailer_test.rb12
4 files changed, 34 insertions, 0 deletions
diff --git a/test/mailers/comment_mailer_test.rb b/test/mailers/comment_mailer_test.rb new file mode 100644 index 0000000..996d230 --- /dev/null +++ b/test/mailers/comment_mailer_test.rb
@@ -0,0 +1,7 @@
1require "test_helper"
2
3class CommentMailerTest < ActionMailer::TestCase
4 # test "the truth" do
5 # assert true
6 # end
7end
diff --git a/test/mailers/previews/comment_mailer_preview.rb b/test/mailers/previews/comment_mailer_preview.rb new file mode 100644 index 0000000..20fc4e6 --- /dev/null +++ b/test/mailers/previews/comment_mailer_preview.rb
@@ -0,0 +1,4 @@
1# Preview all emails at http://localhost:3000/rails/mailers/comment_mailer
2class CommentMailerPreview < ActionMailer::Preview
3
4end
diff --git a/test/mailers/previews/vote_mailer_preview.rb b/test/mailers/previews/vote_mailer_preview.rb new file mode 100644 index 0000000..dfc5da1 --- /dev/null +++ b/test/mailers/previews/vote_mailer_preview.rb
@@ -0,0 +1,11 @@
1# Preview all emails at http://localhost:3000/rails/mailers/vote_mailer
2class VoteMailerPreview < ActionMailer::Preview
3
4 # Preview this email at http://localhost:3000/rails/mailers/vote_mailer/daily_report_email
5 def daily_report_email
6 # Duplicating logic from the task... love it
7 votes = Vote.where("created_at > ?", 1.day.ago).where(upvote: 1).all
8 VoteMailer.with(votes: votes).daily_report_email
9 end
10
11end
diff --git a/test/mailers/vote_mailer_test.rb b/test/mailers/vote_mailer_test.rb new file mode 100644 index 0000000..efe8236 --- /dev/null +++ b/test/mailers/vote_mailer_test.rb
@@ -0,0 +1,12 @@
1require "test_helper"
2
3class VoteMailerTest < ActionMailer::TestCase
4 test "daily_report_email" do
5 mail = VoteMailer.daily_report_email
6 assert_equal "Daily report email", mail.subject
7 assert_equal ["to@example.org"], mail.to
8 assert_equal ["from@example.com"], mail.from
9 assert_match "Hi", mail.body.encoded
10 end
11
12end