mirror of
https://github.com/redmine/redmine.git
synced 2025-11-09 06:46:01 +01:00
Fix random test failure, assertion must be made against displayed values.
IssuesControllerTest#test_index_sort_by_spent_hours_should_sort_by_visible_spent_hours Expected: [3.0, 0.0, 0.0] Actual: [3.0, 4.0, 0.0] git-svn-id: http://svn.redmine.org/redmine/trunk@17672 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -978,13 +978,13 @@ class IssuesControllerTest < Redmine::ControllerTest
|
|||||||
|
|
||||||
get :index, :params => {:sort => "spent_hours:desc", :c => ['subject','spent_hours']}
|
get :index, :params => {:sort => "spent_hours:desc", :c => ['subject','spent_hours']}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal [4.0, 3.0, 0.0], issues_in_list.map(&:spent_hours)[0..2]
|
assert_equal ['4.00', '3.00', '0.00'], columns_values_in_list('spent_hours')[0..2]
|
||||||
|
|
||||||
Project.find(3).disable_module!(:time_tracking)
|
Project.find(3).disable_module!(:time_tracking)
|
||||||
|
|
||||||
get :index, :params => {:sort => "spent_hours:desc", :c => ['subject','spent_hours']}
|
get :index, :params => {:sort => "spent_hours:desc", :c => ['subject','spent_hours']}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal [3.0, 0.0, 0.0], issues_in_list.map(&:spent_hours)[0..2]
|
assert_equal ['3.00', '0.00', '0.00'], columns_values_in_list('spent_hours')[0..2]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_index_sort_by_total_spent_hours
|
def test_index_sort_by_total_spent_hours
|
||||||
|
|||||||
@@ -312,7 +312,12 @@ module Redmine
|
|||||||
def columns_in_list
|
def columns_in_list
|
||||||
css_select('table.list thead th:not(.checkbox)').map(&:text).select(&:present?)
|
css_select('table.list thead th:not(.checkbox)').map(&:text).select(&:present?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the values that are displayed in tds with the given css class
|
||||||
|
def columns_values_in_list(css_class)
|
||||||
|
css_select("table.list tbody td.#{css_class}").map(&:text)
|
||||||
|
end
|
||||||
|
|
||||||
# Verifies that the query filters match the expected filters
|
# Verifies that the query filters match the expected filters
|
||||||
def assert_query_filters(expected_filters)
|
def assert_query_filters(expected_filters)
|
||||||
response.body =~ /initFilters\(\);\s*((addFilter\(.+\);\s*)*)/
|
response.body =~ /initFilters\(\);\s*((addFilter\(.+\);\s*)*)/
|
||||||
|
|||||||
Reference in New Issue
Block a user