summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-06 13:08:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-10-06 13:08:52 +0000
commit015ca366341ba2fa9f1d7903907ddab19a87865f (patch)
treefce88f7a0fb880d3584352e255dfd420c3e798d6 /test
parentb41096d9d00b0eb4c9004936b4ed5f127ec3f2c4 (diff)
downloadredmine-015ca366341ba2fa9f1d7903907ddab19a87865f.tar.gz
redmine-015ca366341ba2fa9f1d7903907ddab19a87865f.zip
Send individual emails for each mail recipient (#26791).
We are creating multipe mails per class notification event, one per recipient, wrapped in a Mailer::MultiMessage object to send them all at once. We keep the existing interface of all class methods intended to be used by external code the same as they were before, with one exception: We provide additional recipient addresses in options[:recipients] for Mailer.security_notification. Since the first-class recipients have to be users to render individual mails for them, additional recipient addresses have to be provided with some other channel. By providing additional recipients in options[:recipients], we can solve the use-case for address change notifications for users, which probably is the only real use-case for having to use a plain email address instead of a User as a notification recipient. Patch by Holger Just and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17583 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/documents_controller_test.rb2
-rw-r--r--test/functional/issues_controller_test.rb226
-rw-r--r--test/functional/issues_custom_fields_visibility_test.rb5
-rw-r--r--test/functional/messages_controller_test.rb15
-rw-r--r--test/functional/news_controller_test.rb2
-rw-r--r--test/unit/changeset_test.rb2
-rw-r--r--test/unit/comment_test.rb2
-rw-r--r--test/unit/document_test.rb2
-rw-r--r--test/unit/issue_test.rb9
-rw-r--r--test/unit/journal_observer_test.rb10
-rw-r--r--test/unit/journal_test.rb2
-rw-r--r--test/unit/mail_handler_test.rb11
-rw-r--r--test/unit/mailer_test.rb14
-rw-r--r--test/unit/news_test.rb2
-rw-r--r--test/unit/repository_test.rb17
-rw-r--r--test/unit/wiki_content_test.rb12
16 files changed, 174 insertions, 159 deletions
diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb
index 0a7aed72b..c8c9fd57c 100644
--- a/test/functional/documents_controller_test.rb
+++ b/test/functional/documents_controller_test.rb
@@ -132,7 +132,7 @@ LOREM
assert_equal Enumeration.find(2), document.category
assert_equal 1, document.attachments.size
assert_equal 'testfile.txt', document.attachments.first.filename
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_with_failure
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index a5fb68b59..17af8981c 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -152,7 +152,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:f => ['tracker_id'],
:op => {
'tracker_id' => '='
- },
+ },
:v => {
'tracker_id' => ['1']
}
@@ -253,10 +253,10 @@ class IssuesControllerTest < Redmine::ControllerTest
:f => [filter_name],
:op => {
filter_name => '='
- },
+ },
:v => {
filter_name => ['Foo']
- },
+ },
:c => ['project']
}
assert_response :success
@@ -1459,7 +1459,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:f => ['start_date'],
:op => {
:start_date => '='
- },
+ },
:format => 'csv'
}
assert_equal 'text/csv', @response.content_type
@@ -2678,7 +2678,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_id => 3,
:description => 'Prefilled',
:custom_field_values => {
- '2' => 'Custom field value'}
+ '2' => 'Custom field value'}
}
}
@@ -2802,7 +2802,7 @@ class IssuesControllerTest < Redmine::ControllerTest
assert !t.disabled_core_fields.include?('parent_issue_id')
get :new, :params => {
- :project_id => 1, issue: { parent_issue_id: 1
+ :project_id => 1, issue: { parent_issue_id: 1
}
}
assert_response :success
@@ -2812,7 +2812,7 @@ class IssuesControllerTest < Redmine::ControllerTest
t.save!
assert t.disabled_core_fields.include?('parent_issue_id')
get :new, :params => {
- :project_id => 1, issue: { parent_issue_id: 1
+ :project_id => 1, issue: { parent_issue_id: 1
}
}
assert_response :success
@@ -2870,7 +2870,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {
:tracker_id => 2,
:status_id => 1
- },
+ },
:was_default_status => 1
}
assert_response :success
@@ -2889,7 +2889,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {
:project_id => 1,
:fixed_version_id => ''
- },
+ },
:form_update_triggered_by => 'issue_project_id'
}
assert_response :success
@@ -2917,7 +2917,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:start_date => '2010-11-07',
:estimated_hours => '',
:custom_field_values => {
- '2' => 'Value for field 2'}
+ '2' => 'Value for field 2'}
}
}
end
@@ -2976,7 +2976,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => 5,
:estimated_hours => '',
:custom_field_values => {
- '2' => 'Value for field 2'}
+ '2' => 'Value for field 2'}
}
}
end
@@ -3002,7 +3002,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => 5,
:estimated_hours => '',
:custom_field_values => {
- '2' => 'Value for field 2'}
+ '2' => 'Value for field 2'}
}
}
end
@@ -3023,7 +3023,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_id => 3,
:subject => 'This is first issue',
:priority_id => 5
- },
+ },
:continue => ''
}
end
@@ -3065,7 +3065,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:description => 'This is the description',
:priority_id => 5,
:custom_field_values => {
- '1' => ['', 'MySQL', 'Oracle']}
+ '1' => ['', 'MySQL', 'Oracle']}
}
}
end
@@ -3088,7 +3088,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:description => 'This is the description',
:priority_id => 5,
:custom_field_values => {
- '1' => ['']}
+ '1' => ['']}
}
}
end
@@ -3111,7 +3111,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:description => 'This is the description',
:priority_id => 5,
:custom_field_values => {
- field.id.to_s => ['', '2', '3']}
+ field.id.to_s => ['', '2', '3']}
}
}
end
@@ -3159,8 +3159,8 @@ class IssuesControllerTest < Redmine::ControllerTest
:due_date => '',
:custom_field_values => {
cf1.id.to_s => '', cf2.id.to_s => ''
- }
-
+ }
+
}
}
assert_response :success
@@ -3189,8 +3189,8 @@ class IssuesControllerTest < Redmine::ControllerTest
:due_date => '',
:custom_field_values => {
cf1.id.to_s => '', cf2.id.to_s => ['']
- }
-
+ }
+
}
}
assert_response :success
@@ -3219,8 +3219,8 @@ class IssuesControllerTest < Redmine::ControllerTest
:due_date => '2012-07-16',
:custom_field_values => {
cf1.id.to_s => 'value1', cf2.id.to_s => 'value2'
- }
-
+ }
+
}
}
assert_response 302
@@ -3246,7 +3246,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_id => 1,
:status_id => 1,
:subject => 'Test'
-
+
}
}
assert_response 302
@@ -3424,7 +3424,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 3,
:tracker_id => 2,
:subject => 'Foo'
- },
+ },
:continue => '1'
}
assert_redirected_to '/issues/new?issue%5Bproject_id%5D=3&issue%5Btracker_id%5D=2'
@@ -3477,13 +3477,13 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => 5,
:estimated_hours => '',
:custom_field_values => {
- '2' => 'Value for field 2'}
+ '2' => 'Value for field 2'}
}
}
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
end
@@ -3536,7 +3536,7 @@ class IssuesControllerTest < Redmine::ControllerTest
post :create, :params => {
:project_id => 1,
:issue => {
- :tracker => "A param can not be a Tracker"
+ :tracker => "A param can not be a Tracker"
}
}
end
@@ -3553,11 +3553,11 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1,
:issue => {
:tracker_id => '1',
- :subject => 'With attachment'
- },
+ :subject => 'With attachment'
+ },
:attachments => {
'1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
}
}
end
@@ -3588,11 +3588,11 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1,
:issue => {
:tracker_id => '1',
- :subject => 'With attachment'
- },
+ :subject => 'With attachment'
+ },
:attachments => {
'1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
}
}
end
@@ -3614,11 +3614,11 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1,
:issue => {
:tracker_id => '1',
- :subject => ''
- },
+ :subject => ''
+ },
:attachments => {
'1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
}
}
assert_response :success
@@ -3645,11 +3645,11 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1,
:issue => {
:tracker_id => '1',
- :subject => ''
- },
+ :subject => ''
+ },
:attachments => {
'p0' => {
- 'token' => attachment.token}
+ 'token' => attachment.token}
}
}
assert_response :success
@@ -3671,11 +3671,11 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => 1,
:issue => {
:tracker_id => '1',
- :subject => 'Saved attachments'
- },
+ :subject => 'Saved attachments'
+ },
:attachments => {
'p0' => {
- 'token' => attachment.token}
+ 'token' => attachment.token}
}
}
assert_response 302
@@ -3997,7 +3997,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => '1',
:tracker_id => '1',
:status_id => '1'
- },
+ },
:was_default_status => '1'
}
end
@@ -4041,7 +4041,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_id => '3',
:status_id => '1',
:subject => 'Copy with attachments'
- },
+ },
:copy_attachments => '1'
}
end
@@ -4089,7 +4089,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_id => '3',
:status_id => '1',
:subject => 'Copy with attachments'
- },
+ },
:copy_attachments => '1',
:attachments => {
'1' => {
@@ -4188,7 +4188,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:tracker_id => '3',
:status_id => '1',
:subject => 'Copy with subtasks'
- },
+ },
:copy_subtasks => '1'
}
end
@@ -4212,8 +4212,8 @@ class IssuesControllerTest < Redmine::ControllerTest
:status_id => '1',
:subject => 'Copy with subtasks',
:custom_field_values => {
- '2' => 'Foo'}
- },
+ '2' => 'Foo'}
+ },
:copy_subtasks => '1'
}
end
@@ -4394,12 +4394,12 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:status_id => 5,
- :priority_id => 7
- },
+ :priority_id => 7
+ },
:time_entry => {
:hours => '2.5',
:comments => 'test_get_edit_with_params',
- :activity_id => 10
+ :activity_id => 10
}
}
assert_response :success
@@ -4638,7 +4638,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:project_id => '1',
:tracker_id => '2',
:priority_id => '6'
-
+
}
}
end
@@ -4701,9 +4701,9 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {
:subject => 'Custom field change',
:custom_field_values => {
- '1' => ['', 'Oracle', 'PostgreSQL']
- }
-
+ '1' => ['', 'Oracle', 'PostgreSQL']
+ }
+
}
}
end
@@ -4724,12 +4724,12 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {
:status_id => 2,
:assigned_to_id => 3,
- :notes => 'Assigned to dlopper'
- },
+ :notes => 'Assigned to dlopper'
+ },
:time_entry => {
:hours => '',
:comments => '',
- :activity_id => TimeEntryActivity.first
+ :activity_id => TimeEntryActivity.first
}
}
end
@@ -4755,7 +4755,7 @@ class IssuesControllerTest < Redmine::ControllerTest
put :update, :params => {
:id => 1,
:issue => {
- :notes => notes
+ :notes => notes
}
}
end
@@ -4823,12 +4823,12 @@ class IssuesControllerTest < Redmine::ControllerTest
put :update, :params => {
:id => 1,
:issue => {
- :notes => '2.5 hours added'
- },
+ :notes => '2.5 hours added'
+ },
:time_entry => {
:hours => '2.5',
:comments => 'test_put_update_with_note_and_spent_time',
- :activity_id => TimeEntryActivity.first.id
+ :activity_id => TimeEntryActivity.first.id
}
}
end
@@ -4883,10 +4883,10 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:notes => ''
- },
+ },
:attachments => {
'1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
}
}
end
@@ -4922,11 +4922,11 @@ class IssuesControllerTest < Redmine::ControllerTest
put :update, :params => {
:id => 1,
:issue => {
- :subject => ''
- },
+ :subject => ''
+ },
:attachments => {
'1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}
}
}
assert_response :success
@@ -4952,11 +4952,11 @@ class IssuesControllerTest < Redmine::ControllerTest
put :update, :params => {
:id => 1,
:issue => {
- :subject => ''
- },
+ :subject => ''
+ },
:attachments => {
'p0' => {
- 'token' => attachment.token}
+ 'token' => attachment.token}
}
}
assert_response :success
@@ -4979,10 +4979,10 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:notes => 'Attachment added'
- },
+ },
:attachments => {
'p0' => {
- 'token' => attachment.token}
+ 'token' => attachment.token}
}
}
assert_redirected_to '/issues/1'
@@ -5007,10 +5007,10 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:notes => ''
- },
+ },
:attachments => {
'1' => {
- 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
+ 'file' => uploaded_test_file('testfile.txt', 'text/plain')}
}
}
assert_redirected_to :action => 'show', :id => '1'
@@ -5030,7 +5030,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {
:notes => 'Removing attachments',
:deleted_attachment_ids => ['1', '5']
-
+
}
}
end
@@ -5057,7 +5057,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:subject => '',
:notes => 'Removing attachments',
:deleted_attachment_ids => ['1', '5']
-
+
}
}
end
@@ -5100,10 +5100,10 @@ class IssuesControllerTest < Redmine::ControllerTest
:subject => new_subject,
:priority_id => '6',
:category_id => '1' # no change
-
+
}
}
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
end
@@ -5116,7 +5116,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:notes => notes
- },
+ },
:time_entry => {
"comments"=>"", "activity_id"=>"", "hours"=>"2z"
}
@@ -5138,7 +5138,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:notes => notes
- },
+ },
:time_entry => {
"comments"=>"this is my comment", "activity_id"=>"", "hours"=>""
}
@@ -5160,7 +5160,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => issue.id,
:issue => {
:fixed_version_id => 4
-
+
}
}
@@ -5178,8 +5178,8 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => issue.id,
:issue => {
:fixed_version_id => 4
-
- },
+
+ },
:back_url => '/issues'
}
@@ -5195,8 +5195,8 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => issue.id,
:issue => {
:fixed_version_id => 4
-
- },
+
+ },
:back_url => 'http://google.com'
}
@@ -5212,7 +5212,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue => {
:status_id => 6,
:notes => 'Notes'
- },
+ },
:prev_issue_id => 8,
:next_issue_id => 12,
:issue_position => 2,
@@ -5501,7 +5501,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {
- '2' => ''}
+ '2' => ''}
}
}
@@ -5531,7 +5531,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => '',
:assigned_to_id => group.id,
:custom_field_values => {
- '2' => ''}
+ '2' => ''}
}
}
@@ -5550,7 +5550,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {
- '2' => ''}
+ '2' => ''}
}
}
@@ -5578,14 +5578,14 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {
- '2' => ''}
+ '2' => ''}
}
}
assert_response 403
assert_not_equal "Bulk should fail", Journal.last.notes
end
- def test_bullk_update_should_send_a_notification
+ def test_bulk_update_should_send_a_notification
@request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear
with_settings :notified_events => %w(issue_updated) do
@@ -5599,7 +5599,7 @@ class IssuesControllerTest < Redmine::ControllerTest
}
}
assert_response 302
- assert_equal 2, ActionMailer::Base.deliveries.size
+ assert_equal 5, ActionMailer::Base.deliveries.size
end
end
@@ -5626,7 +5626,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => 1,
:issue => {
:project_id => '2'
- },
+ },
:follow => '1'
}
assert_redirected_to '/issues/1'
@@ -5638,7 +5638,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:id => [1, 2],
:issue => {
:project_id => '2'
- },
+ },
:follow => '1'
}
assert_redirected_to '/projects/onlinestore/issues'
@@ -5745,7 +5745,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => '',
:assigned_to_id => '',
:custom_field_values => {
- '2' => '777'}
+ '2' => '777'}
}
}
@@ -5768,7 +5768,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => '',
:assigned_to_id => '',
:custom_field_values => {
- '1' => '__none__'}
+ '1' => '__none__'}
}
}
assert_response 302
@@ -5788,7 +5788,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => '',
:assigned_to_id => '',
:custom_field_values => {
- '1' => ['MySQL', 'Oracle']}
+ '1' => ['MySQL', 'Oracle']}
}
}
@@ -5812,7 +5812,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:priority_id => '',
:assigned_to_id => '',
:custom_field_values => {
- '1' => ['__none__']}
+ '1' => ['__none__']}
}
}
assert_response 302
@@ -5969,7 +5969,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:ids => issue_ids,
:issue => {
:project_id => '2'
- },
+ },
:copy => '1'
}
end
@@ -5991,7 +5991,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:ids => [1, 2, 3],
:issue => {
:project_id => '2'
- },
+ },
:copy => '1'
}
assert_response 302
@@ -6006,7 +6006,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:ids => [1, 2, 3],
:issue => {
:project_id => ''
- },
+ },
:copy => '1'
}
assert_response 403
@@ -6020,7 +6020,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:ids => [1, 2, 3],
:issue => {
:project_id => '1'
- },
+ },
:copy => '1'
}
assert_response 403
@@ -6047,7 +6047,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:status_id => '',
:start_date => '',
:due_date => ''
-
+
}
}
end
@@ -6087,7 +6087,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:status_id => '1',
:start_date => '2009-12-01',
:due_date => '2009-12-31'
-
+
}
}
end
@@ -6117,7 +6117,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:status_id => '3',
:start_date => '2009-12-01',
:due_date => '2009-12-31'
-
+
}
}
end
@@ -6140,7 +6140,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_attachments => '0',
:issue => {
:project_id => ''
-
+
}
}
end
@@ -6160,7 +6160,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_attachments => '1',
:issue => {
:project_id => ''
-
+
}
}
end
@@ -6178,7 +6178,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:link_copy => '1',
:issue => {
:project_id => '1'
-
+
}
}
end
@@ -6196,7 +6196,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_subtasks => '0',
:issue => {
:project_id => ''
-
+
}
}
end
@@ -6214,7 +6214,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_subtasks => '1',
:issue => {
:project_id => ''
-
+
}
}
end
@@ -6233,7 +6233,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_watchers => '1',
:issue => {
:project_id => ''
-
+
}
}
end
@@ -6253,7 +6253,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy_subtasks => '1',
:issue => {
:project_id => ''
-
+
}
}
end
@@ -6268,7 +6268,7 @@ class IssuesControllerTest < Redmine::ControllerTest
:copy => '1',
:issue => {
:project_id => 2
- },
+ },
:follow => '1'
}
issue = Issue.order('id DESC').first
diff --git a/test/functional/issues_custom_fields_visibility_test.rb b/test/functional/issues_custom_fields_visibility_test.rb
index 1ce32bf79..485b55be8 100644
--- a/test/functional/issues_custom_fields_visibility_test.rb
+++ b/test/functional/issues_custom_fields_visibility_test.rb
@@ -285,7 +285,8 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
assert_response 302
end
end
- assert_equal users_to_test.values.uniq.size, ActionMailer::Base.deliveries.size
+
+ assert_equal users_to_test.keys.size, ActionMailer::Base.deliveries.size
# tests that each user receives 1 email with the custom fields he is allowed to see only
users_to_test.each do |user, fields|
mails = ActionMailer::Base.deliveries.select {|m| m.bcc.include? user.mail}
@@ -322,7 +323,7 @@ class IssuesCustomFieldsVisibilityTest < Redmine::ControllerTest
}
assert_response 302
end
- assert_equal users_to_test.values.uniq.size, ActionMailer::Base.deliveries.size
+ assert_equal users_to_test.keys.size, ActionMailer::Base.deliveries.size
# tests that each user receives 1 email with the custom fields he is allowed to see only
users_to_test.each do |user, fields|
mails = ActionMailer::Base.deliveries.select {|m| m.bcc.include? user.mail}
diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb
index 0f3d937db..b129cdd33 100644
--- a/test/functional/messages_controller_test.rb
+++ b/test/functional/messages_controller_test.rb
@@ -136,14 +136,17 @@ class MessagesControllerTest < Redmine::ControllerTest
assert_equal 2, message.author_id
assert_equal 1, message.board_id
- mail = ActionMailer::Base.deliveries.last
- assert_not_nil mail
- assert_equal "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] Test created message", mail.subject
- assert_mail_body_match 'Message body', mail
+ mails = ActionMailer::Base.deliveries
+ assert_not_empty mails
+ mails.each do |mail|
+ assert_equal "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] Test created message", mail.subject
+ assert_mail_body_match 'Message body', mail
+ end
+
# author
- assert mail.bcc.include?('jsmith@somenet.foo')
+ assert_equal ['jsmith@somenet.foo'], mails[0].bcc
# project member
- assert mail.bcc.include?('dlopper@somenet.foo')
+ assert_equal ['dlopper@somenet.foo'], mails[1].bcc
end
def test_get_edit
diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb
index f62d21bf1..90a5a1112 100644
--- a/test/functional/news_controller_test.rb
+++ b/test/functional/news_controller_test.rb
@@ -127,7 +127,7 @@ class NewsControllerTest < Redmine::ControllerTest
assert_equal 'This is the description', news.description
assert_equal User.find(2), news.author
assert_equal Project.find(1), news.project
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_post_create_with_attachment
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 8586d8fc7..a1c3cf8dc 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -46,7 +46,7 @@ class ChangesetTest < ActiveSupport::TestCase
fixed = Issue.find(1)
assert fixed.closed?
assert_equal 90, fixed.done_ratio
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_ref_keywords
diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb
index 4597fd9e7..fe9776fc3 100644
--- a/test/unit/comment_test.rb
+++ b/test/unit/comment_test.rb
@@ -36,7 +36,7 @@ class CommentTest < ActiveSupport::TestCase
Watcher.create!(:watchable => @news, :user => @jsmith)
with_settings :notified_events => %w(news_comment_added) do
- assert_difference 'ActionMailer::Base.deliveries.size' do
+ assert_difference 'ActionMailer::Base.deliveries.size', 2 do
Comment.create!(:commented => @news, :author => @jsmith, :comments => "my comment")
end
end
diff --git a/test/unit/document_test.rb b/test/unit/document_test.rb
index 9adcd4724..e4243dd60 100644
--- a/test/unit/document_test.rb
+++ b/test/unit/document_test.rb
@@ -41,7 +41,7 @@ class DocumentTest < ActiveSupport::TestCase
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
assert doc.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_with_default_category
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index a6ace2fa0..432dd8745 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -2529,7 +2529,7 @@ class IssueTest < ActiveSupport::TestCase
:subject => 'test_create', :estimated_hours => '1:30')
with_settings :notified_events => %w(issue_added) do
assert issue.save
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
end
@@ -2541,7 +2541,7 @@ class IssueTest < ActiveSupport::TestCase
:subject => 'test_create', :estimated_hours => '1:30')
with_settings :notified_events => %w(issue_added issue_updated) do
assert issue.save
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
end
@@ -2568,7 +2568,8 @@ class IssueTest < ActiveSupport::TestCase
issue.init_journal User.find(1)
issue.assigned_to = nil
issue.save!
- assert_include user.mail, ActionMailer::Base.deliveries.last.bcc
+
+ assert_include [user.mail], ActionMailer::Base.deliveries.map(&:bcc)
end
end
@@ -2581,7 +2582,7 @@ class IssueTest < ActiveSupport::TestCase
issue.subject = 'Subjet update'
with_settings :notified_events => %w(issue_updated) do
assert issue.save
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
ActionMailer::Base.deliveries.clear
stale.init_journal(User.find(1))
diff --git a/test/unit/journal_observer_test.rb b/test/unit/journal_observer_test.rb
index e9eac32e5..17695538a 100644
--- a/test/unit/journal_observer_test.rb
+++ b/test/unit/journal_observer_test.rb
@@ -36,7 +36,7 @@ class JournalObserverTest < ActiveSupport::TestCase
with_settings :notified_events => %w(issue_updated) do
assert journal.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_with_notify_set_to_false
@@ -71,7 +71,7 @@ class JournalObserverTest < ActiveSupport::TestCase
with_settings :notified_events => %w(issue_note_added) do
assert journal.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_note_added
@@ -95,7 +95,7 @@ class JournalObserverTest < ActiveSupport::TestCase
with_settings :notified_events => %w(issue_status_updated) do
assert issue.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_status_updated
@@ -132,7 +132,7 @@ class JournalObserverTest < ActiveSupport::TestCase
with_settings :notified_events => %w(issue_assigned_to_updated) do
assert issue.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_assignee_updated
@@ -157,7 +157,7 @@ class JournalObserverTest < ActiveSupport::TestCase
with_settings :notified_events => %w(issue_priority_updated) do
assert issue.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_priority_updated
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb
index cca405a2e..9bbedd1d5 100644
--- a/test/unit/journal_test.rb
+++ b/test/unit/journal_test.rb
@@ -50,7 +50,7 @@ class JournalTest < ActiveSupport::TestCase
journal = issue.init_journal(user, issue)
assert journal.save
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_should_not_save_journal_with_blank_notes_and_no_details
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 401198fed..8aa2cdbe8 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -440,10 +440,11 @@ class MailHandlerTest < ActiveSupport::TestCase
)
end
- # only 1 email for the new issue notification
- assert_equal 1, ActionMailer::Base.deliveries.size
- email = ActionMailer::Base.deliveries.first
- assert_include 'Ticket by unknown user', email.subject
+ # only 2 emails for the new issue notification
+ assert_equal 2, ActionMailer::Base.deliveries.size
+ ActionMailer::Base.deliveries.each do |email|
+ assert_include 'Ticket by unknown user', email.subject
+ end
end
def test_created_user_should_have_mail_notification_to_none_with_no_notification_option
@@ -877,7 +878,7 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_update_issue_should_send_email_notification
journal = submit_email('ticket_reply.eml')
assert journal.is_a?(Journal)
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 3, ActionMailer::Base.deliveries.size
end
def test_update_issue_should_not_set_defaults
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index 049db8198..0908e9e63 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -412,11 +412,15 @@ class MailerTest < ActiveSupport::TestCase
journal.save!
Role.find(2).add_permission! :view_private_notes
- Mailer.deliver_issue_edit(journal)
- assert_equal %w(dlopper@somenet.foo jsmith@somenet.foo), ActionMailer::Base.deliveries.last.bcc.sort
+ assert_difference 'ActionMailer::Base.deliveries.size', 2 do
+ Mailer.deliver_issue_edit(journal)
+ end
+ assert_equal %w(dlopper@somenet.foo jsmith@somenet.foo), ActionMailer::Base.deliveries.last(2).flat_map(&:bcc).sort
Role.find(2).remove_permission! :view_private_notes
- Mailer.deliver_issue_edit(journal)
+ assert_difference 'ActionMailer::Base.deliveries.size', 1 do
+ Mailer.deliver_issue_edit(journal)
+ end
assert_equal %w(jsmith@somenet.foo), ActionMailer::Base.deliveries.last.bcc.sort
end
@@ -534,7 +538,7 @@ class MailerTest < ActiveSupport::TestCase
def test_wiki_content_added
content = WikiContent.find(1)
with_each_language_as_default do
- assert_difference 'ActionMailer::Base.deliveries.size' do
+ assert_difference 'ActionMailer::Base.deliveries.size', 2 do
assert Mailer.wiki_content_added(content).deliver
assert_select_email do
assert_select 'a[href=?]',
@@ -548,7 +552,7 @@ class MailerTest < ActiveSupport::TestCase
def test_wiki_content_updated
content = WikiContent.find(1)
with_each_language_as_default do
- assert_difference 'ActionMailer::Base.deliveries.size' do
+ assert_difference 'ActionMailer::Base.deliveries.size', 2 do
assert Mailer.wiki_content_updated(content).deliver
assert_select_email do
assert_select 'a[href=?]',
diff --git a/test/unit/news_test.rb b/test/unit/news_test.rb
index 7899ec2c2..03a868a91 100644
--- a/test/unit/news_test.rb
+++ b/test/unit/news_test.rb
@@ -34,7 +34,7 @@ class NewsTest < ActiveSupport::TestCase
with_settings :notified_events => %w(news_added) do
assert news.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
+ assert_equal 2, ActionMailer::Base.deliveries.size
end
def test_should_include_news_for_projects_with_news_enabled
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index 59f011f9f..9552d0948 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -262,14 +262,15 @@ class RepositoryTest < ActiveSupport::TestCase
assert_equal User.find_by_login('dlopper'), journal.user
assert_equal 'Applied in changeset r2.', journal.notes
- # 2 email notifications
- assert_equal 2, ActionMailer::Base.deliveries.size
- mail = ActionMailer::Base.deliveries.first
- assert_not_nil mail
- assert mail.subject.starts_with?(
- "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
- assert_mail_body_match(
- "Status changed from #{old_status} to #{fixed_issue.status}", mail)
+ # 5 email notifications, 2 for #1, 3 for #2
+ assert_equal 5, ActionMailer::Base.deliveries.size
+ ActionMailer::Base.deliveries.first(2).each do |mail|
+ assert_not_nil mail
+ assert mail.subject.starts_with?(
+ "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
+ assert_mail_body_match(
+ "Status changed from #{old_status} to #{fixed_issue.status}", mail)
+ end
# ignoring commits referencing an issue of another project
assert_equal [], Issue.find(4).changesets
diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb
index d3cb74427..1b6dcf095 100644
--- a/test/unit/wiki_content_test.rb
+++ b/test/unit/wiki_content_test.rb
@@ -53,8 +53,10 @@ class WikiContentTest < ActiveSupport::TestCase
assert page.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
- assert_include 'wiki page has been added', mail_body(ActionMailer::Base.deliveries.last)
+ assert_equal 2, ActionMailer::Base.deliveries.size
+ ActionMailer::Base.deliveries.each do |mail|
+ assert_include 'wiki page has been added', mail_body(mail)
+ end
end
def test_update_should_be_versioned
@@ -100,8 +102,10 @@ class WikiContentTest < ActiveSupport::TestCase
assert content.save
end
- assert_equal 1, ActionMailer::Base.deliveries.size
- assert_include 'wiki page has been updated', mail_body(ActionMailer::Base.deliveries.last)
+ assert_equal 2, ActionMailer::Base.deliveries.size
+ ActionMailer::Base.deliveries.each do |mail|
+ assert_include 'wiki page has been updated', mail_body(mail)
+ end
end
def test_fetch_history