diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-28 09:59:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-28 09:59:34 +0000 |
commit | 21fc903c0424c45c86430588b0ecb8f0cc589efa (patch) | |
tree | d9654cffe1586acae13bf7cdcfca21292f8a6429 /test | |
parent | dc5e5eca6b7cb124da1e47036f8a688bb4a7688c (diff) | |
download | redmine-21fc903c0424c45c86430588b0ecb8f0cc589efa.tar.gz redmine-21fc903c0424c45c86430588b0ecb8f0cc589efa.zip |
Fixed that sorting time entries by custom field raises a SQL error (#14366).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12042 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/timelog_controller_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 5735260ca..9d07d3e21 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -559,6 +559,24 @@ class TimelogControllerTest < ActionController::TestCase assert_select "td.#{field_name}", :text => 'CF Value' end + def test_index_with_time_entry_custom_field_sorting + field = TimeEntryCustomField.generate!(:field_format => 'string', :name => 'String Field') + TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value 1'}) + TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value 3'}) + TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value 2'}) + field_name = "cf_#{field.id}" + + get :index, :c => ["hours", field_name], :sort => field_name + assert_response :success + assert_include field_name.to_sym, assigns(:query).column_names + assert_select "th a.sort", :text => 'String Field' + + # Make sure that values are properly sorted + values = assigns(:entries).map {|e| e.custom_field_value(field)}.compact + assert_equal 3, values.size + assert_equal values.sort, values + end + def test_index_atom_feed get :index, :project_id => 1, :format => 'atom' assert_response :success |