summaryrefslogtreecommitdiffstats
path: root/test/unit/lib
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-02-04 10:06:11 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-02-04 10:06:11 +0000
commit8543dfd1095ea81623d91c2587e50e889017c597 (patch)
treebc39ed49979b700cd17ca947aa8d69329370cfc0 /test/unit/lib
parent10c6b0e84f0beebe44f09ed316ab5eaa218cb5dd (diff)
downloadredmine-8543dfd1095ea81623d91c2587e50e889017c597.tar.gz
redmine-8543dfd1095ea81623d91c2587e50e889017c597.zip
replace shoulda context "#number_of_rows" at GanttHelperTest
git-svn-id: http://svn.redmine.org/redmine/trunk@12788 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib')
-rw-r--r--test/unit/lib/redmine/helpers/gantt_test.rb64
1 files changed, 29 insertions, 35 deletions
diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb
index 7658116e0..49d11a7ac 100644
--- a/test/unit/lib/redmine/helpers/gantt_test.rb
+++ b/test/unit/lib/redmine/helpers/gantt_test.rb
@@ -56,44 +56,38 @@ class Redmine::Helpers::GanttHelperTest < ActionView::TestCase
end
private :create_gantt
- context "#number_of_rows" do
- context "with one project" do
- 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
+ test "#number_of_rows with one 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
- context "with no project" do
- 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
+ test "#number_of_rows with no project 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
- should "not exceed max_rows option" do
- p = Project.generate!
- 5.times do
- Issue.generate!(:project => p)
- end
- create_gantt(p)
- @gantt.render
- assert_equal 6, @gantt.number_of_rows
- assert !@gantt.truncated
- create_gantt(p, :max_rows => 3)
- @gantt.render
- assert_equal 3, @gantt.number_of_rows
- assert @gantt.truncated
+ test "#number_of_rows should not exceed max_rows option" do
+ p = Project.generate!
+ 5.times do
+ Issue.generate!(:project => p)
end
+ create_gantt(p)
+ @gantt.render
+ assert_equal 6, @gantt.number_of_rows
+ assert !@gantt.truncated
+ create_gantt(p, :max_rows => 3)
+ @gantt.render
+ assert_equal 3, @gantt.number_of_rows
+ assert @gantt.truncated
end
context "#number_of_rows_on_project" do