diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-16 20:09:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-06-16 20:09:12 +0000 |
commit | 2c07b478bb1e2954c44d9def732202a8edea9837 (patch) | |
tree | ee86c7ba28af094c6f0d13d992b445f9f3fc5d36 /test | |
parent | 542b355210f901e9628127b8ae9a4de1787710f7 (diff) | |
download | redmine-2c07b478bb1e2954c44d9def732202a8edea9837.tar.gz redmine-2c07b478bb1e2954c44d9def732202a8edea9837.zip |
Fixed that time entries should be sorted by date and created_on (#11178).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9837 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/timelog_controller_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index c972fc2ab..3e159c39d 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -568,6 +568,20 @@ class TimelogControllerTest < ActionController::TestCase :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} end + def test_index_should_sort_by_spent_on_and_created_on + t1 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:00:00', :activity_id => 10) + t2 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:05:00', :activity_id => 10) + t3 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-15', :created_on => '2012-06-16 20:10:00', :activity_id => 10) + + get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16' + assert_response :success + assert_equal [t2, t1, t3], assigns(:entries) + + get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16', :sort => 'spent_on' + assert_response :success + assert_equal [t3, t1, t2], assigns(:entries) + end + def test_index_atom_feed get :index, :project_id => 1, :format => 'atom' assert_response :success |