##// END OF EJS Templates
The descendant count in the issues delete confirmation message is wrong if issues share some descendants....
The descendant count in the issues delete confirmation message is wrong if issues share some descendants. git-svn-id: http://svn.redmine.org/redmine/trunk@13818 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r12701:0b5e7d2a3c27
r13436:bfdd9f7c295d
Show More
journal_observer_test.rb
174 lines | 5.4 KiB | text/x-ruby | RubyLexer
/ test / unit / journal_observer_test.rb
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 # Redmine - project management software
Toshi MARUYAMA
update copyright year (#15977)...
r12461 # Copyright (C) 2006-2014 Jean-Philippe Lang
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687 #
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687 #
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107
class JournalObserverTest < ActiveSupport::TestCase
Jean-Baptiste Barth
Fixed some more test/unit/*_test.rb breaking when run alone (#12285)...
r10564 fixtures :issues, :issue_statuses, :journals, :journal_details, :projects,
:projects_trackers, :trackers, :enabled_modules, :enumerations,
:users, :roles
Eric Davis
Added three new notifiable events based on issue attributes...
r4107
def setup
ActionMailer::Base.deliveries.clear
@journal = Journal.find 1
end
# context: issue_updated notified_events
def test_create_should_send_email_notification_with_issue_updated
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 journal = issue.init_journal(user, "some notes")
Eric Davis
Added three new notifiable events based on issue attributes...
r4107
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => %w(issue_updated) do
assert journal.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 1, ActionMailer::Base.deliveries.size
end
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 def test_create_should_not_send_email_notification_with_notify_set_to_false
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 journal = issue.init_journal(user, "some notes")
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 journal.notify = false
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => %w(issue_updated) do
assert journal.save
end
Jean-Philippe Lang
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 assert_equal 0, ActionMailer::Base.deliveries.size
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107
def test_create_should_not_send_email_notification_without_issue_updated
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 journal = issue.init_journal(user, "some notes")
Eric Davis
Added three new notifiable events based on issue attributes...
r4107
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => [] do
assert journal.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 0, ActionMailer::Base.deliveries.size
end
def test_create_should_send_email_notification_with_issue_note_added
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 journal = issue.init_journal(user)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 journal.notes = 'This update has a note'
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => %w(issue_note_added) do
assert journal.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_note_added
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 journal = issue.init_journal(user)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 journal.notes = 'This update has a note'
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => [] do
assert journal.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 0, ActionMailer::Base.deliveries.size
end
def test_create_should_send_email_notification_with_issue_status_updated
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.status = IssueStatus.last
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => %w(issue_status_updated) do
assert issue.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_status_updated
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.status = IssueStatus.last
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => [] do
assert issue.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 0, ActionMailer::Base.deliveries.size
end
Jean-Philippe Lang
Adds an option to send email on "Assignee updated" in application settings (#16362)....
r12699 def test_create_without_status_update_should_not_send_email_notification_with_issue_status_updated
issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Jean-Philippe Lang
Adds an option to send email on "Assignee updated" in application settings (#16362)....
r12699 issue.subject = "No status update"
with_settings :notified_events => %w(issue_status_updated) do
assert issue.save
end
assert_equal 0, ActionMailer::Base.deliveries.size
end
def test_create_should_send_email_notification_with_issue_assignee_updated
issue = Issue.generate!(:assigned_to_id => 2)
ActionMailer::Base.deliveries.clear
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Jean-Philippe Lang
Adds an option to send email on "Assignee updated" in application settings (#16362)....
r12699 issue.assigned_to = User.find(3)
with_settings :notified_events => %w(issue_assigned_to_updated) do
assert issue.save
end
assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_assignee_updated
issue = Issue.generate!(:assigned_to_id => 2)
ActionMailer::Base.deliveries.clear
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Jean-Philippe Lang
Adds an option to send email on "Assignee updated" in application settings (#16362)....
r12699 issue.assigned_to = User.find(3)
with_settings :notified_events => [] do
assert issue.save
end
assert_equal 0, ActionMailer::Base.deliveries.size
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 def test_create_should_send_email_notification_with_issue_priority_updated
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.priority = IssuePriority.last
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => %w(issue_priority_updated) do
assert issue.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_create_should_not_send_email_notification_without_issue_priority_updated
Jean-Philippe Lang
Replaces find(:first) calls....
r10701 issue = Issue.first
user = User.first
Jean-Philippe Lang
Wrong argument....
r12701 issue.init_journal(user)
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.priority = IssuePriority.last
Toshi MARUYAMA
remove trailing white-spaces and an empty line from unit journal observer test....
r5687
Jean-Philippe Lang
Tests should not change settings....
r9766 with_settings :notified_events => [] do
assert issue.save
end
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 assert_equal 0, ActionMailer::Base.deliveries.size
end
end