##// END OF EJS Templates
Replaces find(:first) calls....
Replaces find(:first) calls. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10930 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r10701:31c33f462d92
r10703:a7023dfa9b8e
Show More
journal_observer_test.rb
139 lines | 4.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
Jean-Philippe Lang
Copyright update....
r9453 # Copyright (C) 2006-2012 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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 journal = issue.init_journal(user, issue)
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
Fixed: notes are lost when copying issue(s) (#6901, #8239)....
r5482 journal = issue.init_journal(user, issue)
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 journal = issue.init_journal(user, issue)
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
# context: issue_note_added notified_events
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 journal = issue.init_journal(user, issue)
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 journal = issue.init_journal(user, issue)
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
# context: issue_status_updated notified_events
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.init_journal(user, issue)
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.init_journal(user, issue)
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
# context: issue_priority_updated notified_events
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.init_journal(user, issue)
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
Eric Davis
Added three new notifiable events based on issue attributes...
r4107 issue.init_journal(user, issue)
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