@@ -57,11 +57,26 class Redmine::Helpers::GanttHelperTest < ActionView::TestCase | |||||
57 |
|
57 | |||
58 | context "#number_of_rows" do |
|
58 | context "#number_of_rows" do | |
59 | context "with one project" do |
|
59 | context "with one project" do | |
60 | should "return the number of rows just for that project" |
|
60 | should "return the number of rows just for that project" do | |
|
61 | p1, p2 = Project.generate!, Project.generate! | |||
|
62 | i1, i2 = Issue.generate!(:project => p1), Issue.generate!(:project => p2) | |||
|
63 | create_gantt(p1) | |||
|
64 | assert_equal 2, @gantt.number_of_rows | |||
|
65 | end | |||
61 | end |
|
66 | end | |
62 |
|
67 | |||
63 | context "with no project" do |
|
68 | context "with no project" do | |
64 | should "return the total number of rows for all the projects, resursively" |
|
69 | should "return the total number of rows for all the projects, resursively" do | |
|
70 | p1, p2 = Project.generate!, Project.generate! | |||
|
71 | create_gantt(nil) | |||
|
72 | #fix the return value of #number_of_rows_on_project() to an arbitrary value | |||
|
73 | #so that we really only test #number_of_rows | |||
|
74 | @gantt.stubs(:number_of_rows_on_project).returns(7) | |||
|
75 | #also fix #projects because we want to test #number_of_rows in isolation | |||
|
76 | @gantt.stubs(:projects).returns(Project.all) | |||
|
77 | #actual test | |||
|
78 | assert_equal Project.count*7, @gantt.number_of_rows | |||
|
79 | end | |||
65 | end |
|
80 | end | |
66 |
|
81 | |||
67 | should "not exceed max_rows option" do |
|
82 | should "not exceed max_rows option" do |
General Comments 0
You need to be logged in to leave comments.
Login now