Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -20,12 +22,12 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||
class JournalObserverTest < ActiveSupport::TestCase
|
||||
fixtures :issues, :issue_statuses, :journals, :journal_details, :projects,
|
||||
:projects_trackers, :trackers, :enabled_modules, :enumerations,
|
||||
:users, :email_addresses, :roles
|
||||
:users, :user_preferences, :email_addresses, :roles, :members, :member_roles,
|
||||
:versions
|
||||
|
||||
def setup
|
||||
User.current = nil
|
||||
ActionMailer::Base.deliveries.clear
|
||||
@journal = Journal.find 1
|
||||
end
|
||||
|
||||
# context: issue_updated notified_events
|
||||
|
@ -37,7 +39,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
|
||||
|
@ -72,7 +74,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
|
||||
|
@ -96,7 +98,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
|
||||
|
@ -133,7 +135,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
|
||||
|
@ -158,7 +160,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
|
||||
|
@ -172,4 +174,28 @@ class JournalObserverTest < ActiveSupport::TestCase
|
|||
end
|
||||
assert_equal 0, ActionMailer::Base.deliveries.size
|
||||
end
|
||||
|
||||
def test_create_should_send_email_notification_with_issue_fixed_version_updated
|
||||
with_settings :notified_events => %w(issue_fixed_version_updated) do
|
||||
user = User.find_by_login('jsmith')
|
||||
issue = issues(:issues_001)
|
||||
issue.init_journal(user)
|
||||
issue.fixed_version = versions(:versions_003)
|
||||
|
||||
assert issue.save
|
||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||
end
|
||||
end
|
||||
|
||||
def test_create_should_not_send_email_notification_without_issue_fixed_version_updated
|
||||
with_settings :notified_events => [] do
|
||||
user = User.find_by_login('jsmith')
|
||||
issue = issues(:issues_001)
|
||||
issue.init_journal(user)
|
||||
issue.fixed_version = versions(:versions_003)
|
||||
|
||||
assert issue.save
|
||||
assert_equal 0, ActionMailer::Base.deliveries.size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue