summaryrefslogtreecommitdiffstats
path: root/test/unit/time_entry_test.rb
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-06-20 15:26:47 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-06-20 15:26:47 +0000
commitbfcb1b0054ce6ab397025622c4e7309bc8e1dbcb (patch)
treef0fd76f0112da704a3999cf43643204164d4126d /test/unit/time_entry_test.rb
parente0f0f2c210e0c05a28beb20ede23143fc302f0a6 (diff)
downloadredmine-bfcb1b0054ce6ab397025622c4e7309bc8e1dbcb.tar.gz
redmine-bfcb1b0054ce6ab397025622c4e7309bc8e1dbcb.zip
Fix time entry activity is not set as default when the default activity exists as project specific activity (#33914).
Patch by Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@21668 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_test.rb')
-rw-r--r--test/unit/time_entry_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb
index 0998d98b9..7f9e18173 100644
--- a/test/unit/time_entry_test.rb
+++ b/test/unit/time_entry_test.rb
@@ -126,6 +126,19 @@ class TimeEntryTest < ActiveSupport::TestCase
end
end
+ def test_activity_id_should_default_activity_id
+ project = Project.find(1)
+ default_activity = TimeEntryActivity.find(10)
+ entry = TimeEntry.new(project: project)
+ assert_equal entry.activity_id, default_activity.id
+
+ # If there are project specific activities
+ project_specific_default_activity = TimeEntryActivity.create!(name: 'Development', parent_id: 10, project_id: project.id, is_default: false)
+ entry = TimeEntry.new(project: project)
+ assert_not_equal entry.activity_id, default_activity.id
+ assert_equal entry.activity_id, project_specific_default_activity.id
+ end
+
def test_should_accept_future_dates
entry = TimeEntry.generate
entry.spent_on = User.current.today + 1