diff options
author | Go MAEDA <maeda@farend.jp> | 2022-07-17 00:16:31 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2022-07-17 00:16:31 +0000 |
commit | 6badcf374bcbaf7bdfcfd9a416158430ff02f5e6 (patch) | |
tree | e80537f31b77ff0743aa81e04601a79faf96b07e /test | |
parent | e61a02e18cb6be302819dcc2fef735af3f74a6c5 (diff) | |
download | redmine-6badcf374bcbaf7bdfcfd9a416158430ff02f5e6.tar.gz redmine-6badcf374bcbaf7bdfcfd9a416158430ff02f5e6.zip |
Make the only enabled activity in a project the default one for time entry (#10314).
Patch by Mizuki ISHIKAWA.
git-svn-id: https://svn.redmine.org/redmine/trunk@21709 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/time_entry_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb index 7f9e18173..088af3504 100644 --- a/test/unit/time_entry_test.rb +++ b/test/unit/time_entry_test.rb @@ -139,6 +139,21 @@ class TimeEntryTest < ActiveSupport::TestCase assert_equal entry.activity_id, project_specific_default_activity.id end + def test_activity_id_should_be_set_automatically_if_there_is_only_one_activity_available + project = Project.find(1) + TimeEntry.all.destroy_all + TimeEntryActivity.destroy_all + only_one_activity = TimeEntryActivity.create!( + name: 'Development', + parent_id: nil, + project_id: nil, + is_default: false + ) + + entry = TimeEntry.new(project: project) + assert_equal entry.activity_id, only_one_activity.id + end + def test_should_accept_future_dates entry = TimeEntry.generate entry.spent_on = User.current.today + 1 |