From 9c9dc6e8147a3e0bf3239511c094dc5f9d2a59a0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 17 May 2009 09:55:13 +0000 Subject: Adds email notification on wiki changes (#413). It's disabled by default and can be enabled in application settings. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2749 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/wiki_content_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/unit/wiki_content_test.rb') diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb index a8c28ae21..f3f8bc041 100644 --- a/test/unit/wiki_content_test.rb +++ b/test/unit/wiki_content_test.rb @@ -40,6 +40,16 @@ class WikiContentTest < Test::Unit::TestCase assert_equal User.find(1), content.author assert_equal content.text, content.versions.last.text end + + def test_create_should_send_email_notification + Setting.notified_events = ['wiki_content_added'] + ActionMailer::Base.deliveries.clear + page = WikiPage.new(:wiki => @wiki, :title => "A new page") + page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment") + assert page.save + + assert_equal 1, ActionMailer::Base.deliveries.size + end def test_update content = @page.content @@ -51,6 +61,16 @@ class WikiContentTest < Test::Unit::TestCase assert_equal version_count+1, content.versions.length end + def test_update_should_send_email_notification + Setting.notified_events = ['wiki_content_updated'] + ActionMailer::Base.deliveries.clear + content = @page.content + content.text = "My new content" + assert content.save + + assert_equal 1, ActionMailer::Base.deliveries.size + end + def test_fetch_history assert !@page.content.versions.empty? @page.content.versions.each do |version| -- cgit v1.2.3