diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 12:05:49 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 12:05:49 +0000 |
commit | 34f2d382b75e1b094734e0f35db6224253951df6 (patch) | |
tree | 8746b18b93553ce1a75d90bbe7c44ce8ea4b491b /test/unit/time_entry_test.rb | |
parent | ab0ef8331086f11172cb651db223db2801532f2d (diff) | |
download | redmine-34f2d382b75e1b094734e0f35db6224253951df6.tar.gz redmine-34f2d382b75e1b094734e0f35db6224253951df6.zip |
add unit test to validate time entry
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7447 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_test.rb')
-rw-r--r-- | test/unit/time_entry_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb index bdf4cbef3..f207ecd92 100644 --- a/test/unit/time_entry_test.rb +++ b/test/unit/time_entry_test.rb @@ -93,6 +93,23 @@ class TimeEntryTest < ActiveSupport::TestCase assert_equal Date.today, c.spent_on end + def test_validate_time_entry + anon = User.anonymous + project = Project.find(1) + issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => anon.id, :status_id => 1, + :priority => IssuePriority.all.first, :subject => 'test_create', + :description => 'IssueTest#test_create', :estimated_hours => '1:30') + assert issue.save + activity = TimeEntryActivity.find_by_name('Design') + te = TimeEntry.create(:spent_on => '2010-01-01', + :hours => 100000, + :issue => issue, + :project => project, + :user => anon, + :activity => activity) + assert_equal 1, te.errors.count + end + context "#earilest_date_for_project" do setup do User.current = nil |