diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-05-30 08:46:41 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-05-30 08:46:41 +0000 |
commit | 62bed8b93f1bdfdc8ee52db00133bfe0880d4842 (patch) | |
tree | 997b7ecf37e67438ff80fb1031fc6a25d2439d33 /test/unit/time_entry_test.rb | |
parent | 216a153421b05bce4d4e64b590889b740367b92e (diff) | |
download | redmine-62bed8b93f1bdfdc8ee52db00133bfe0880d4842.tar.gz redmine-62bed8b93f1bdfdc8ee52db00133bfe0880d4842.zip |
Validates that activity belongs to project activities (#19656).
git-svn-id: http://svn.redmine.org/redmine/trunk@14288 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_test.rb')
-rw-r--r-- | test/unit/time_entry_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb index 9154c6008..c9386cc37 100644 --- a/test/unit/time_entry_test.rb +++ b/test/unit/time_entry_test.rb @@ -142,6 +142,14 @@ class TimeEntryTest < ActiveSupport::TestCase assert_equal 1, te.errors.count end + def test_acitivity_should_belong_to_project_activities + activity = TimeEntryActivity.create!(:name => 'Other project activity', :project_id => 2, :active => true) + + entry = TimeEntry.new(:spent_on => Date.today, :hours => 1.0, :user => User.find(1), :project_id => 1, :activity => activity) + assert !entry.valid? + assert_include I18n.translate('activerecord.errors.messages.inclusion'), entry.errors[:activity_id] + end + def test_spent_on_with_2_digits_year_should_not_be_valid entry = TimeEntry.new(:project => Project.find(1), :user => User.find(1), :activity => TimeEntryActivity.first, :hours => 1) entry.spent_on = "09-02-04" |