summaryrefslogtreecommitdiffstats
path: root/test/unit/lib/redmine/helpers/gantt_test.rb
diff options
context:
space:
mode:
authorJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>2013-05-02 23:42:03 +0000
committerJean-Baptiste Barth <jeanbaptiste.barth@gmail.com>2013-05-02 23:42:03 +0000
commit208d6d881c6f9930ce0faf357045b38f6d223fba (patch)
tree6ca723b995f4f4be1a94e973e5973f7de6d85753 /test/unit/lib/redmine/helpers/gantt_test.rb
parentbc68c1c039409847cb2476fb1f52da7aac510dc5 (diff)
downloadredmine-208d6d881c6f9930ce0faf357045b38f6d223fba.tar.gz
redmine-208d6d881c6f9930ce0faf357045b38f6d223fba.zip
Add missing tests for Redmine::Helpers::Gantt#number_of_rows.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11771 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib/redmine/helpers/gantt_test.rb')
-rw-r--r--test/unit/lib/redmine/helpers/gantt_test.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb
index 8ea341198..4b5622bf4 100644
--- a/test/unit/lib/redmine/helpers/gantt_test.rb
+++ b/test/unit/lib/redmine/helpers/gantt_test.rb
@@ -57,11 +57,26 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
context "#number_of_rows" do
context "with one project" do
- should "return the number of rows just for that project"
+ should "return the number of rows just for that project" do
+ p1, p2 = Project.generate!, Project.generate!
+ i1, i2 = Issue.generate!(:project => p1), Issue.generate!(:project => p2)
+ create_gantt(p1)
+ assert_equal 2, @gantt.number_of_rows
+ end
end
context "with no project" do
- should "return the total number of rows for all the projects, resursively"
+ should "return the total number of rows for all the projects, resursively" do
+ p1, p2 = Project.generate!, Project.generate!
+ create_gantt(nil)
+ #fix the return value of #number_of_rows_on_project() to an arbitrary value
+ #so that we really only test #number_of_rows
+ @gantt.stubs(:number_of_rows_on_project).returns(7)
+ #also fix #projects because we want to test #number_of_rows in isolation
+ @gantt.stubs(:projects).returns(Project.all)
+ #actual test
+ assert_equal Project.count*7, @gantt.number_of_rows
+ end
end
should "not exceed max_rows option" do