]> source.dussan.org Git - redmine.git/commitdiff
Added tests for Issue#by_X finders
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 4 Feb 2010 17:24:28 +0000 (17:24 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 4 Feb 2010 17:24:28 +0000 (17:24 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3364 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/issue_test.rb

index b22b05c78a5c2853ed2a91969b8c37878b85d82c..86d3e245570ff100bcc8d47f63bf80a427bd5a5d 100644 (file)
@@ -589,4 +589,46 @@ class IssueTest < ActiveSupport::TestCase
       end
     end
   end
+
+  test "#by_tracker" do
+    groups = Issue.by_tracker(Project.find(1))
+    assert_equal 3, groups.size
+    assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
+
+  test "#by_version" do
+    groups = Issue.by_version(Project.find(1))
+    assert_equal 3, groups.size
+    assert_equal 3, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
+
+  test "#by_priority" do
+    groups = Issue.by_priority(Project.find(1))
+    assert_equal 4, groups.size
+    assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
+
+  test "#by_category" do
+    groups = Issue.by_category(Project.find(1))
+    assert_equal 2, groups.size
+    assert_equal 3, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
+
+  test "#by_assigned_to" do
+    groups = Issue.by_assigned_to(Project.find(1))
+    assert_equal 2, groups.size
+    assert_equal 2, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
+
+  test "#by_author" do
+    groups = Issue.by_author(Project.find(1))
+    assert_equal 4, groups.size
+    assert_equal 7, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
+
+  test "#by_subproject" do
+    groups = Issue.by_subproject(Project.find(1))
+    assert_equal 2, groups.size
+    assert_equal 5, groups.inject(0) {|sum, group| sum + group['total'].to_i}
+  end
 end