summaryrefslogtreecommitdiffstats
path: root/test/functional/issues_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-20 16:51:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-20 16:51:18 +0000
commitcd1ca24a87b2cacba1937e4b5d94d1276ed1e4ed (patch)
tree505573a583da67798b32c5b6b1190f66c525df57 /test/functional/issues_controller_test.rb
parent3c63273c23c66c31848d2a5d10f2e8e77193d6ab (diff)
downloadredmine-cd1ca24a87b2cacba1937e4b5d94d1276ed1e4ed.tar.gz
redmine-cd1ca24a87b2cacba1937e4b5d94d1276ed1e4ed.zip
Fix that spent_time total on the issue list can be wrong (#26471).
git-svn-id: http://svn.redmine.org/redmine/trunk@16839 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/issues_controller_test.rb')
-rw-r--r--test/functional/issues_controller_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 53c90bc3e..02cdf85e3 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -952,6 +952,22 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_equal hours.sort.reverse, hours
end
+ def test_index_sort_by_spent_hours_should_sort_by_visible_spent_hours
+ TimeEntry.delete_all
+ TimeEntry.generate!(:issue => Issue.generate!(:project_id => 1), :hours => 3)
+ TimeEntry.generate!(:issue => Issue.generate!(:project_id => 3), :hours => 4)
+
+ get :index, :params => {:sort => "spent_hours:desc", :c => ['subject','spent_hours']}
+ assert_response :success
+ assert_equal [4.0, 3.0, 0.0], issues_in_list.map(&:spent_hours)[0..2]
+
+ Project.find(3).disable_module!(:time_tracking)
+
+ get :index, :params => {:sort => "spent_hours:desc", :c => ['subject','spent_hours']}
+ assert_response :success
+ assert_equal [3.0, 0.0, 0.0], issues_in_list.map(&:spent_hours)[0..2]
+ end
+
def test_index_sort_by_total_spent_hours
get :index, :params => {
:sort => 'total_spent_hours:desc'
@@ -1390,6 +1406,22 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select ".total-for-cf-#{field.id} span.value", :text => '9'
end
+ def test_index_with_spent_time_total_should_sum_visible_spent_time_only
+ TimeEntry.delete_all
+ TimeEntry.generate!(:issue => Issue.generate!(:project_id => 1), :hours => 3)
+ TimeEntry.generate!(:issue => Issue.generate!(:project_id => 3), :hours => 4)
+
+ get :index, :params => {:t => ["spent_hours"]}
+ assert_response :success
+ assert_select ".total-for-spent-hours span.value", :text => '7.00'
+
+ Project.find(3).disable_module!(:time_tracking)
+
+ get :index, :params => {:t => ["spent_hours"]}
+ assert_response :success
+ assert_select ".total-for-spent-hours span.value", :text => '3.00'
+ end
+
def test_index_totals_should_default_to_settings
with_settings :issue_list_default_totals => ['estimated_hours'] do
get :index