summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-04-03 07:54:27 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-04-03 07:54:27 +0000
commit5914b0ebc29ad050a41c8e3147f4894b2b33cc23 (patch)
tree2cb97e139c63a5867c6329c3f611e1f93d7544db /test/unit
parentb1e4411c497161eca7a977db5243ff92bff88d82 (diff)
downloadredmine-5914b0ebc29ad050a41c8e3147f4894b2b33cc23.tar.gz
redmine-5914b0ebc29ad050a41c8e3147f4894b2b33cc23.zip
Allow imported time entries to override the selected project with the actual project of their issue (#36823).
Patch by Jens Krämer. git-svn-id: https://svn.redmine.org/redmine/trunk@21522 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/time_entry_import_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/time_entry_import_test.rb b/test/unit/time_entry_import_test.rb
index f0ec41cb7..36e7f574d 100644
--- a/test/unit/time_entry_import_test.rb
+++ b/test/unit/time_entry_import_test.rb
@@ -165,6 +165,28 @@ class TimeEntryImportTest < ActiveSupport::TestCase
assert_equal 2, fourth.user_id
end
+ def test_imports_timelogs_for_issues_in_other_project
+ import = generate_import
+ import.settings = {
+ 'separator' => ';', 'wrapper' => '"', 'encoding' => 'UTF-8',
+ 'mapping' => {
+ 'project_id' => '3',
+ 'activity' => 'value:10',
+ 'issue_id' => '1',
+ 'spent_on' => '2',
+ 'hours' => '3',
+ 'comments' => '4',
+ 'user' => '7'
+ }
+ }
+ import.save!
+ first, second, third, fourth = new_records(TimeEntry, 4) {import.run}
+ assert_equal 3, first.project_id
+ assert_equal 3, second.project_id
+ assert_equal 1, third.project_id
+ assert_equal 1, fourth.project_id
+ end
+
protected
def generate_import(fixture_name='import_time_entries.csv')