summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-12 18:13:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-07-12 18:13:20 +0000
commit2a721fff4cec3d1e14c924566d0d1334152a3393 (patch)
tree666f8780bbcdc16c63c7da4d0ddb9fd0f3308d7c /test/functional
parentffea3d5ba3cea6a5f6b1d500ae5417fe158a4546 (diff)
downloadredmine-2a721fff4cec3d1e14c924566d0d1334152a3393.tar.gz
redmine-2a721fff4cec3d1e14c924566d0d1334152a3393.zip
Set default configuration for the timelog list (#26356).
git-svn-id: http://svn.redmine.org/redmine/trunk@16814 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/timelog_controller_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 89b1ccfcf..37c584472 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -28,6 +28,11 @@ class TimelogControllerTest < Redmine::ControllerTest
include Redmine::I18n
+ def setup
+ super
+ Setting.default_language = 'en'
+ end
+
def test_new
@request.session[:user_id] = 3
get :new
@@ -705,6 +710,36 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_select '.total-for-hours', :text => 'Hours: 162.90'
assert_select 'form#query_form[action=?]', '/time_entries'
+
+ assert_equal ['Date', 'User', 'Activity', 'Issue', 'Comment', 'Hours'], columns_in_list
+ assert_select '.query-totals>span', 1
+ end
+
+ def test_index_with_default_query_setting
+ with_settings :time_entry_list_defaults => {'column_names' => %w(spent_on issue user hours)} do
+ get :index
+ assert_response :success
+ end
+
+ assert_equal ['Date', 'Issue', 'User', 'Hours'], columns_in_list
+ end
+
+ def test_index_with_default_query_setting_using_custom_field
+ field = TimeEntryCustomField.create!(:name => 'Foo', :field_format => 'int')
+
+ with_settings :time_entry_list_defaults => {
+ 'column_names' => ["spent_on", "user", "hours", "cf_#{field.id}"],
+ 'totalable_names' => ["hours", "cf_#{field.id}"]
+ } do
+ get :index
+ assert_response :success
+ end
+
+ assert_equal ['Date', 'User', 'Hours', 'Foo'], columns_in_list
+
+ assert_select '.total-for-hours'
+ assert_select ".total-for-cf-#{field.id}"
+ assert_select '.query-totals>span', 2
end
def test_index_all_projects_should_show_log_time_link