Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 7
- Log:
Initial import of RForum 0.2 sources from a downloaded Tarball.
RForum is a Ruby On Rails based forum and mail gateway service.
- Author:
- adh
- Date:
- Sat Jul 22 18:43:13 +0100 2006
- Size:
- 1921 Bytes
1 | #!/bin/env ruby |
2 | |
3 | require File.dirname(__FILE__) + '/../test_helper' |
4 | require 'mailer' |
5 | |
6 | class MailerTest < Test::Unit::TestCase |
7 | fixtures 'users', 'posts', 'topics', 'forums' |
8 | |
9 | def setup |
10 | @sent_mail = ActionMailer::Base.deliveries = [] |
11 | end |
12 | |
13 | def teardown |
14 | ActionMailer::Base.deliveries = [] |
15 | end |
16 | |
17 | def test_registration_mail |
18 | Mailer.deliver_registration_mail(User.find(1), 'some password', |
19 | 'http://localhost:3000/user/login') |
20 | assert_equal 1, @sent_mail.size |
21 | end |
22 | |
23 | def test_new_post_notification |
24 | Mailer.deliver_new_post_notification(User.find(1), Post.find(1)) |
25 | assert_equal 1, @sent_mail.size |
26 | end |
27 | |
28 | def test_reset_password |
29 | Mailer.deliver_reset_password(User.find(1), 'url_to_reset') |
30 | assert_equal 1, @sent_mail.size |
31 | assert_match /url_to_reset/, @sent_mail[0].encoded |
32 | end |
33 | |
34 | def test_user_message |
35 | text = "hello user2" |
36 | Mailer.deliver_user_message(User.find(1), User.find(2), text) |
37 | assert_match /#{text}/, @sent_mail[0].encoded |
38 | assert_match /#{User.find(1).name}/, @sent_mail[0].encoded |
39 | assert_match /#{RForum::CONFIG[:mail_charset]}/, @sent_mail[0]['content-type'].to_s |
40 | assert_equal User.find(1).email, @sent_mail[0]['from'].to_s |
41 | end |
42 | |
43 | def test_delete_post_notification |
44 | Mailer.deliver_delete_post_notification(Post.find(1)) |
45 | assert_match /#{Post.find(1).subject}/, @sent_mail[0].encoded |
46 | end |
47 | |
48 | def test_ml_post_no_list |
49 | p = Post.find(1) |
50 | assert_raises(RuntimeError) { Mailer.deliver_ml_post(p) } |
51 | end |
52 | |
53 | def test_ml_post |
54 | p = Post.find(21) |
55 | Mailer.deliver_ml_post(p) |
56 | assert @sent_mail[0].body[p.text] |
57 | assert_equal p.subject, @sent_mail[0].subject |
58 | assert_equal p.author.email, @sent_mail[0].from[0] |
59 | assert_equal p.topic.forum.list_address, @sent_mail[0].to[0] |
60 | assert_equal 'test1', @sent_mail[0].header['header1'].to_s |
61 | assert_equal 'test2', @sent_mail[0].header['header2'].to_s |
62 | end |
63 | |
64 | end |
65 |