OSDN Git Service

Added tests for Issue#recipients
authorEric Davis <edavis@littlestreamsoftware.com>
Tue, 28 Sep 2010 18:22:05 +0000 (18:22 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Tue, 28 Sep 2010 18:22:05 +0000 (18:22 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4217 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/issue_test.rb

index 043eac1..d293cb8 100644 (file)
@@ -544,7 +544,7 @@ class IssueTest < ActiveSupport::TestCase
     assert issue.save
     assert_equal 1, ActionMailer::Base.deliveries.size
   end
-  
+
   def test_stale_issue_should_not_send_email_notification
     ActionMailer::Base.deliveries.clear
     issue = Issue.find(1)
@@ -738,4 +738,28 @@ class IssueTest < ActiveSupport::TestCase
     assert issue.save
     assert_equal before, Issue.on_active_project.length
   end
+
+  context "Issue#recipients" do
+    setup do
+      @project = Project.find(1)
+      @issue = Issue.generate_for_project!(@project, :assigned_to => User.generate_with_protected!)
+    end
+    
+    should "include project recipients" do
+      assert @project.recipients.present?
+      @project.recipients.each do |project_recipient|
+        assert @issue.recipients.include?(project_recipient)
+      end
+    end
+
+    should "include the author if the author is active" do
+      assert @issue.author, "No author set for Issue"
+      assert @issue.recipients.include?(@issue.author.mail)
+    end
+    
+    should "include the assigned to user if the assigned to user is active" do
+      assert @issue.assigned_to, "No assigned_to set for Issue"
+      assert @issue.recipients.include?(@issue.assigned_to.mail)
+    end
+  end
 end