diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2020-04-05 19:28:37 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2020-04-05 19:28:37 +0000 |
commit | 192263b8568eb1af813f4b2582f7f7362b72336c (patch) | |
tree | 6acd49eb9c1897113f94387ad5cc1dc423b0c824 /test/unit/time_entry_import_test.rb | |
parent | 31c8e71d8ec3e0070118a545254d592fc8ad4baa (diff) | |
download | redmine-192263b8568eb1af813f4b2582f7f7362b72336c.tar.gz redmine-192263b8568eb1af813f4b2582f7f7362b72336c.zip |
Don't use User.current in TimeEntryImport model but #user instead (#32774).
git-svn-id: http://svn.redmine.org/redmine/trunk@19678 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_import_test.rb')
-rw-r--r-- | test/unit/time_entry_import_test.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/unit/time_entry_import_test.rb b/test/unit/time_entry_import_test.rb index b56e59267..0d4a53940 100644 --- a/test/unit/time_entry_import_test.rb +++ b/test/unit/time_entry_import_test.rb @@ -127,7 +127,8 @@ class TimeEntryImportTest < ActiveSupport::TestCase end def test_maps_user_id_for_user_with_permissions - User.current = User.find(1) + Role.find_by_name('Manager').add_permission! :log_time_for_other_users + import = generate_import_with_mapping first, second, third, fourth = new_records(TimeEntry, 4) { import.run } @@ -138,16 +139,17 @@ class TimeEntryImportTest < ActiveSupport::TestCase end def test_maps_user_to_column_value - User.current = User.find(1) + Role.find_by_name('Manager').add_permission! :log_time_for_other_users + import = generate_import_with_mapping - import.mapping.merge!('user' => 'value:1') + import.mapping.merge!('user' => 'value:3') import.save! first, second, third, fourth = new_records(TimeEntry, 4) { import.run } - assert_equal 1, first.user_id - assert_equal 1, second.user_id - assert_equal 1, third.user_id - assert_equal 1, fourth.user_id + assert_equal 3, first.user_id + assert_equal 3, second.user_id + assert_equal 3, third.user_id + assert_equal 3, fourth.user_id end def test_maps_user_id_for_user_without_permissions |