@@ -31,7 +31,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
31 | def test_create_should_send_email_notification_with_issue_updated |
|
31 | def test_create_should_send_email_notification_with_issue_updated | |
32 | issue = Issue.first |
|
32 | issue = Issue.first | |
33 | user = User.first |
|
33 | user = User.first | |
34 |
journal = issue.init_journal(user, |
|
34 | journal = issue.init_journal(user, "some notes") | |
35 |
|
35 | |||
36 | with_settings :notified_events => %w(issue_updated) do |
|
36 | with_settings :notified_events => %w(issue_updated) do | |
37 | assert journal.save |
|
37 | assert journal.save | |
@@ -42,7 +42,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
42 | def test_create_should_not_send_email_notification_with_notify_set_to_false |
|
42 | def test_create_should_not_send_email_notification_with_notify_set_to_false | |
43 | issue = Issue.first |
|
43 | issue = Issue.first | |
44 | user = User.first |
|
44 | user = User.first | |
45 |
journal = issue.init_journal(user, |
|
45 | journal = issue.init_journal(user, "some notes") | |
46 | journal.notify = false |
|
46 | journal.notify = false | |
47 |
|
47 | |||
48 | with_settings :notified_events => %w(issue_updated) do |
|
48 | with_settings :notified_events => %w(issue_updated) do | |
@@ -54,7 +54,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
54 | def test_create_should_not_send_email_notification_without_issue_updated |
|
54 | def test_create_should_not_send_email_notification_without_issue_updated | |
55 | issue = Issue.first |
|
55 | issue = Issue.first | |
56 | user = User.first |
|
56 | user = User.first | |
57 |
journal = issue.init_journal(user, |
|
57 | journal = issue.init_journal(user, "some notes") | |
58 |
|
58 | |||
59 | with_settings :notified_events => [] do |
|
59 | with_settings :notified_events => [] do | |
60 | assert journal.save |
|
60 | assert journal.save | |
@@ -62,11 +62,10 class JournalObserverTest < ActiveSupport::TestCase | |||||
62 | assert_equal 0, ActionMailer::Base.deliveries.size |
|
62 | assert_equal 0, ActionMailer::Base.deliveries.size | |
63 | end |
|
63 | end | |
64 |
|
64 | |||
65 | # context: issue_note_added notified_events |
|
|||
66 | def test_create_should_send_email_notification_with_issue_note_added |
|
65 | def test_create_should_send_email_notification_with_issue_note_added | |
67 | issue = Issue.first |
|
66 | issue = Issue.first | |
68 | user = User.first |
|
67 | user = User.first | |
69 |
journal = issue.init_journal(user |
|
68 | journal = issue.init_journal(user) | |
70 | journal.notes = 'This update has a note' |
|
69 | journal.notes = 'This update has a note' | |
71 |
|
70 | |||
72 | with_settings :notified_events => %w(issue_note_added) do |
|
71 | with_settings :notified_events => %w(issue_note_added) do | |
@@ -78,7 +77,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
78 | def test_create_should_not_send_email_notification_without_issue_note_added |
|
77 | def test_create_should_not_send_email_notification_without_issue_note_added | |
79 | issue = Issue.first |
|
78 | issue = Issue.first | |
80 | user = User.first |
|
79 | user = User.first | |
81 |
journal = issue.init_journal(user |
|
80 | journal = issue.init_journal(user) | |
82 | journal.notes = 'This update has a note' |
|
81 | journal.notes = 'This update has a note' | |
83 |
|
82 | |||
84 | with_settings :notified_events => [] do |
|
83 | with_settings :notified_events => [] do | |
@@ -90,7 +89,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
90 | def test_create_should_send_email_notification_with_issue_status_updated |
|
89 | def test_create_should_send_email_notification_with_issue_status_updated | |
91 | issue = Issue.first |
|
90 | issue = Issue.first | |
92 | user = User.first |
|
91 | user = User.first | |
93 |
issue.init_journal(user |
|
92 | issue.init_journal(user) | |
94 | issue.status = IssueStatus.last |
|
93 | issue.status = IssueStatus.last | |
95 |
|
94 | |||
96 | with_settings :notified_events => %w(issue_status_updated) do |
|
95 | with_settings :notified_events => %w(issue_status_updated) do | |
@@ -102,7 +101,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
102 | def test_create_should_not_send_email_notification_without_issue_status_updated |
|
101 | def test_create_should_not_send_email_notification_without_issue_status_updated | |
103 | issue = Issue.first |
|
102 | issue = Issue.first | |
104 | user = User.first |
|
103 | user = User.first | |
105 |
issue.init_journal(user |
|
104 | issue.init_journal(user) | |
106 | issue.status = IssueStatus.last |
|
105 | issue.status = IssueStatus.last | |
107 |
|
106 | |||
108 | with_settings :notified_events => [] do |
|
107 | with_settings :notified_events => [] do | |
@@ -114,7 +113,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
114 | def test_create_without_status_update_should_not_send_email_notification_with_issue_status_updated |
|
113 | def test_create_without_status_update_should_not_send_email_notification_with_issue_status_updated | |
115 | issue = Issue.first |
|
114 | issue = Issue.first | |
116 | user = User.first |
|
115 | user = User.first | |
117 |
issue.init_journal(user |
|
116 | issue.init_journal(user) | |
118 | issue.subject = "No status update" |
|
117 | issue.subject = "No status update" | |
119 |
|
118 | |||
120 | with_settings :notified_events => %w(issue_status_updated) do |
|
119 | with_settings :notified_events => %w(issue_status_updated) do | |
@@ -127,7 +126,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
127 | issue = Issue.generate!(:assigned_to_id => 2) |
|
126 | issue = Issue.generate!(:assigned_to_id => 2) | |
128 | ActionMailer::Base.deliveries.clear |
|
127 | ActionMailer::Base.deliveries.clear | |
129 | user = User.first |
|
128 | user = User.first | |
130 |
issue.init_journal(user |
|
129 | issue.init_journal(user) | |
131 | issue.assigned_to = User.find(3) |
|
130 | issue.assigned_to = User.find(3) | |
132 |
|
131 | |||
133 | with_settings :notified_events => %w(issue_assigned_to_updated) do |
|
132 | with_settings :notified_events => %w(issue_assigned_to_updated) do | |
@@ -140,7 +139,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
140 | issue = Issue.generate!(:assigned_to_id => 2) |
|
139 | issue = Issue.generate!(:assigned_to_id => 2) | |
141 | ActionMailer::Base.deliveries.clear |
|
140 | ActionMailer::Base.deliveries.clear | |
142 | user = User.first |
|
141 | user = User.first | |
143 |
issue.init_journal(user |
|
142 | issue.init_journal(user) | |
144 | issue.assigned_to = User.find(3) |
|
143 | issue.assigned_to = User.find(3) | |
145 |
|
144 | |||
146 | with_settings :notified_events => [] do |
|
145 | with_settings :notified_events => [] do | |
@@ -152,7 +151,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
152 | def test_create_should_send_email_notification_with_issue_priority_updated |
|
151 | def test_create_should_send_email_notification_with_issue_priority_updated | |
153 | issue = Issue.first |
|
152 | issue = Issue.first | |
154 | user = User.first |
|
153 | user = User.first | |
155 |
issue.init_journal(user |
|
154 | issue.init_journal(user) | |
156 | issue.priority = IssuePriority.last |
|
155 | issue.priority = IssuePriority.last | |
157 |
|
156 | |||
158 | with_settings :notified_events => %w(issue_priority_updated) do |
|
157 | with_settings :notified_events => %w(issue_priority_updated) do | |
@@ -164,7 +163,7 class JournalObserverTest < ActiveSupport::TestCase | |||||
164 | def test_create_should_not_send_email_notification_without_issue_priority_updated |
|
163 | def test_create_should_not_send_email_notification_without_issue_priority_updated | |
165 | issue = Issue.first |
|
164 | issue = Issue.first | |
166 | user = User.first |
|
165 | user = User.first | |
167 |
issue.init_journal(user |
|
166 | issue.init_journal(user) | |
168 | issue.priority = IssuePriority.last |
|
167 | issue.priority = IssuePriority.last | |
169 |
|
168 | |||
170 | with_settings :notified_events => [] do |
|
169 | with_settings :notified_events => [] do |
General Comments 0
You need to be logged in to leave comments.
Login now