replace shoulda context "#number_of_rows" at GanttHelperTest

git-svn-id: http://svn.redmine.org/redmine/trunk@12788 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-04 10:06:11 +00:00
parent 10c6b0e84f
commit 8543dfd109
1 changed files with 29 additions and 35 deletions

View File

@ -56,31 +56,26 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
end end
private :create_gantt private :create_gantt
context "#number_of_rows" do test "#number_of_rows with one project should return the number of rows just for that project" do
context "with one project" do
should "return the number of rows just for that project" do
p1, p2 = Project.generate!, Project.generate! p1, p2 = Project.generate!, Project.generate!
i1, i2 = Issue.generate!(:project => p1), Issue.generate!(:project => p2) i1, i2 = Issue.generate!(:project => p1), Issue.generate!(:project => p2)
create_gantt(p1) create_gantt(p1)
assert_equal 2, @gantt.number_of_rows assert_equal 2, @gantt.number_of_rows
end end
end
context "with no project" do test "#number_of_rows with no project should return the total number of rows for all the projects, resursively" do
should "return the total number of rows for all the projects, resursively" do
p1, p2 = Project.generate!, Project.generate! p1, p2 = Project.generate!, Project.generate!
create_gantt(nil) create_gantt(nil)
#fix the return value of #number_of_rows_on_project() to an arbitrary value # fix the return value of #number_of_rows_on_project() to an arbitrary value
#so that we really only test #number_of_rows # so that we really only test #number_of_rows
@gantt.stubs(:number_of_rows_on_project).returns(7) @gantt.stubs(:number_of_rows_on_project).returns(7)
#also fix #projects because we want to test #number_of_rows in isolation # also fix #projects because we want to test #number_of_rows in isolation
@gantt.stubs(:projects).returns(Project.all) @gantt.stubs(:projects).returns(Project.all)
#actual test # actual test
assert_equal Project.count*7, @gantt.number_of_rows assert_equal Project.count*7, @gantt.number_of_rows
end end
end
should "not exceed max_rows option" do test "#number_of_rows should not exceed max_rows option" do
p = Project.generate! p = Project.generate!
5.times do 5.times do
Issue.generate!(:project => p) Issue.generate!(:project => p)
@ -94,7 +89,6 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
assert_equal 3, @gantt.number_of_rows assert_equal 3, @gantt.number_of_rows
assert @gantt.truncated assert @gantt.truncated
end end
end
context "#number_of_rows_on_project" do context "#number_of_rows_on_project" do
setup do setup do