Added observers to watch model objects for mail delivery instead of calling Mailer.

* Added an IssueObserver to watch when Issues are created
* Added a JournalObserver to watch when Journals are created (Issue updates)
* Added a NewsObserver for News items.
* Added a DocumentObserver for Document notifications.
* Setup IssuesController#new to use the IssueObserver.
* Setup IssuesController#edit to use the IssueObserver.
* Setup IssuesController#bulk_edit to use the JournalObserver.
* Removed the Mailer call in Changeset#scan_commit_for_issue_ids, the
  JournalObserver will handle it.
* Removed Mailer calls in MailHandler in favor of the Observers.

  #2659

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2637 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2009-03-28 00:38:57 +00:00
parent 3557e767e0
commit b4be8849c0
19 changed files with 206 additions and 18 deletions
+15
View File
@@ -133,6 +133,14 @@ class MailHandlerTest < Test::Unit::TestCase
Role.anonymous.add_permission!(:add_issues)
assert_equal false, submit_email('ticket_without_from_header.eml')
end
def test_add_issue_should_send_email_notification
ActionMailer::Base.deliveries.clear
# This email contains: 'Project: onlinestore'
issue = submit_email('ticket_on_given_project.eml')
assert issue.is_a?(Issue)
assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_add_issue_note
journal = submit_email('ticket_reply.eml')
@@ -152,6 +160,13 @@ class MailHandlerTest < Test::Unit::TestCase
assert_match /This is reply/, journal.notes
assert_equal IssueStatus.find_by_name("Resolved"), issue.status
end
def test_add_issue_note_should_send_email_notification
ActionMailer::Base.deliveries.clear
journal = submit_email('ticket_reply.eml')
assert journal.is_a?(Journal)
assert_equal 1, ActionMailer::Base.deliveries.size
end
def test_reply_to_a_message
m = submit_email('message_reply.eml')