comparison test/unit/.svn/text-base/journal_observer_test.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 8661b858af72
children
comparison
equal deleted inserted replaced
245:051f544170fe 441:cbce1fd3b1b7
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2009 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
8 # 8 #
9 # This program is distributed in the hope that it will be useful, 9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. 12 # GNU General Public License for more details.
13 # 13 #
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 require File.expand_path('../../test_helper', __FILE__) 18 require File.expand_path('../../test_helper', __FILE__)
32 user = User.find(:first) 32 user = User.find(:first)
33 journal = issue.init_journal(user, issue) 33 journal = issue.init_journal(user, issue)
34 34
35 assert journal.save 35 assert journal.save
36 assert_equal 1, ActionMailer::Base.deliveries.size 36 assert_equal 1, ActionMailer::Base.deliveries.size
37 end
38
39 def test_create_should_not_send_email_notification_with_notify_set_to_false
40 Setting.notified_events = ['issue_updated']
41 issue = Issue.find(:first)
42 user = User.find(:first)
43 journal = issue.init_journal(user, issue)
44 journal.notify = false
45
46 assert journal.save
47 assert_equal 0, ActionMailer::Base.deliveries.size
37 end 48 end
38 49
39 def test_create_should_not_send_email_notification_without_issue_updated 50 def test_create_should_not_send_email_notification_without_issue_updated
40 Setting.notified_events = [] 51 Setting.notified_events = []
41 issue = Issue.find(:first) 52 issue = Issue.find(:first)
62 Setting.notified_events = [] 73 Setting.notified_events = []
63 issue = Issue.find(:first) 74 issue = Issue.find(:first)
64 user = User.find(:first) 75 user = User.find(:first)
65 journal = issue.init_journal(user, issue) 76 journal = issue.init_journal(user, issue)
66 journal.notes = 'This update has a note' 77 journal.notes = 'This update has a note'
67 78
68 assert journal.save 79 assert journal.save
69 assert_equal 0, ActionMailer::Base.deliveries.size 80 assert_equal 0, ActionMailer::Base.deliveries.size
70 end 81 end
71 82
72 # context: issue_status_updated notified_events 83 # context: issue_status_updated notified_events
85 Setting.notified_events = [] 96 Setting.notified_events = []
86 issue = Issue.find(:first) 97 issue = Issue.find(:first)
87 user = User.find(:first) 98 user = User.find(:first)
88 issue.init_journal(user, issue) 99 issue.init_journal(user, issue)
89 issue.status = IssueStatus.last 100 issue.status = IssueStatus.last
90 101
91 assert issue.save 102 assert issue.save
92 assert_equal 0, ActionMailer::Base.deliveries.size 103 assert_equal 0, ActionMailer::Base.deliveries.size
93 end 104 end
94 105
95 # context: issue_priority_updated notified_events 106 # context: issue_priority_updated notified_events
108 Setting.notified_events = [] 119 Setting.notified_events = []
109 issue = Issue.find(:first) 120 issue = Issue.find(:first)
110 user = User.find(:first) 121 user = User.find(:first)
111 issue.init_journal(user, issue) 122 issue.init_journal(user, issue)
112 issue.priority = IssuePriority.last 123 issue.priority = IssuePriority.last
113 124
114 assert issue.save 125 assert issue.save
115 assert_equal 0, ActionMailer::Base.deliveries.size 126 assert_equal 0, ActionMailer::Base.deliveries.size
116 end 127 end
117
118 end 128 end