@@ -1084,7 +1084,7 class UserTest < ActiveSupport::TestCase | |||||
1084 | assert_equal true, @anonymous.allowed_to_globally?(:view_issues) |
|
1084 | assert_equal true, @anonymous.allowed_to_globally?(:view_issues) | |
1085 | end |
|
1085 | end | |
1086 |
|
1086 | |||
1087 |
def test_notify_about_ |
|
1087 | def test_notify_about_issue | |
1088 | project = Project.find(1) |
|
1088 | project = Project.find(1) | |
1089 | author = User.generate! |
|
1089 | author = User.generate! | |
1090 | assignee = User.generate! |
|
1090 | assignee = User.generate! | |
@@ -1092,32 +1092,35 class UserTest < ActiveSupport::TestCase | |||||
1092 | Member.create!(:user => member, :project => project, :role_ids => [1]) |
|
1092 | Member.create!(:user => member, :project => project, :role_ids => [1]) | |
1093 | issue = Issue.generate!(:project => project, :assigned_to => assignee, :author => author) |
|
1093 | issue = Issue.generate!(:project => project, :assigned_to => assignee, :author => author) | |
1094 |
|
1094 | |||
1095 | author.mail_notification = 'all' |
|
1095 | tests = { | |
1096 | assert author.notify_about?(issue) |
|
1096 | author => %w(all only_my_events only_owner selected), | |
1097 | author.mail_notification = 'only_my_events' |
|
1097 | assignee => %w(all only_my_events only_assigned selected), | |
1098 | assert author.notify_about?(issue) |
|
1098 | member => %w(all) | |
1099 | author.mail_notification = 'only_owner' |
|
1099 | } | |
1100 | assert author.notify_about?(issue) |
|
1100 | ||
1101 | author.mail_notification = 'selected' |
|
1101 | tests.each do |user, expected| | |
1102 | assert author.notify_about?(issue) |
|
1102 | User::MAIL_NOTIFICATION_OPTIONS.map(&:first).each do |option| | |
1103 |
|
|
1103 | user.mail_notification = option | |
1104 |
assert |
|
1104 | assert_equal expected.include?(option), user.notify_about?(issue) | |
1105 |
|
1105 | end | ||
1106 | assignee.mail_notification = 'only_my_events' |
|
1106 | end | |
1107 | assert assignee.notify_about?(issue) |
|
1107 | end | |
1108 | assignee.mail_notification = 'only_owner' |
|
1108 | ||
1109 | assert !assignee.notify_about?(issue) |
|
1109 | def test_notify_about_issue_for_previous_assignee | |
1110 |
assignee |
|
1110 | assignee = User.generate!(:mail_notification => 'only_assigned') | |
|
1111 | new_assignee = User.generate!(:mail_notification => 'only_assigned') | |||
|
1112 | issue = Issue.generate!(:assigned_to => assignee) | |||
|
1113 | ||||
1111 | assert assignee.notify_about?(issue) |
|
1114 | assert assignee.notify_about?(issue) | |
1112 | assignee.mail_notification = 'selected' |
|
1115 | assert !new_assignee.notify_about?(issue) | |
|
1116 | ||||
|
1117 | issue.assigned_to = new_assignee | |||
1113 | assert assignee.notify_about?(issue) |
|
1118 | assert assignee.notify_about?(issue) | |
|
1119 | assert new_assignee.notify_about?(issue) | |||
1114 |
|
1120 | |||
1115 | member.mail_notification = 'only_my_events' |
|
1121 | issue.save! | |
1116 |
assert ! |
|
1122 | assert !assignee.notify_about?(issue) | |
1117 | member.mail_notification = 'only_assigned' |
|
1123 | assert new_assignee.notify_about?(issue) | |
1118 | assert !member.notify_about?(issue) |
|
|||
1119 | member.mail_notification = 'selected' |
|
|||
1120 | assert !member.notify_about?(issue) |
|
|||
1121 | end |
|
1124 | end | |
1122 |
|
1125 | |||
1123 | def test_notify_about_news |
|
1126 | def test_notify_about_news |
General Comments 0
You need to be logged in to leave comments.
Login now