summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-02-27 20:50:19 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-02-27 20:50:19 +0000
commit200842ba5e753f342940d7df0f1cc342ae8485d4 (patch)
tree50ceded1ab5f0472b3896a07a330b8304521a84d /test/functional
parent421d4203113a3cefdcc6998a9b9cc92ddbb27321 (diff)
downloadredmine-200842ba5e753f342940d7df0f1cc342ae8485d4.tar.gz
redmine-200842ba5e753f342940d7df0f1cc342ae8485d4.zip
Propagates time tracking to the parent project (closes #433). Time report enhancements.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1176 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/timelog_controller_test.rb30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index e1236ffac..4163ce548 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -37,27 +37,39 @@ class TimelogControllerTest < Test::Unit::TestCase
end
def test_report_one_criteria
- get :report, :project_id => 1, :period => "month", :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member"]
+ get :report, :project_id => 1, :period => 'week', :date_from => "2007-04-01", :date_to => "2007-04-30", :criterias => ['project']
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:hours)
- end
+ assert_not_nil assigns(:total_hours)
+ assert_equal "8.65", "%.2f" % assigns(:total_hours)
+ end
def test_report_two_criterias
- get :report, :project_id => 1, :period => "week", :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
+ get :report, :project_id => 1, :period => 'month', :date_from => "2007-01-01", :date_to => "2007-12-31", :criterias => ["member", "activity"]
assert_response :success
assert_template 'report'
- assert_not_nil assigns(:hours)
+ assert_not_nil assigns(:total_hours)
+ assert_equal "162.90", "%.2f" % assigns(:total_hours)
end
+ def test_report_one_criteria_no_result
+ get :report, :project_id => 1, :period => 'week', :date_from => "1998-04-01", :date_to => "1998-04-30", :criterias => ['project']
+ assert_response :success
+ assert_template 'report'
+ assert_not_nil assigns(:total_hours)
+ assert_equal "0.00", "%.2f" % assigns(:total_hours)
+ end
+
def test_details_at_project_level
get :details, :project_id => 1
assert_response :success
assert_template 'details'
assert_not_nil assigns(:entries)
- assert_equal 3, assigns(:entries).size
+ assert_equal 4, assigns(:entries).size
+ # project and subproject
+ assert_equal [1, 3], assigns(:entries).collect(&:project_id).uniq.sort
assert_not_nil assigns(:total_hours)
- assert_equal 155.25, assigns(:total_hours)
+ assert_equal "162.90", "%.2f" % assigns(:total_hours)
# display all time by default
assert_nil assigns(:from)
assert_nil assigns(:to)
@@ -68,9 +80,9 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'details'
assert_not_nil assigns(:entries)
- assert_equal 2, assigns(:entries).size
+ assert_equal 3, assigns(:entries).size
assert_not_nil assigns(:total_hours)
- assert_equal 5.25, assigns(:total_hours)
+ assert_equal "12.90", "%.2f" % assigns(:total_hours)
assert_equal '2007-03-20'.to_date, assigns(:from)
assert_equal '2007-04-30'.to_date, assigns(:to)
end