diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 13:38:21 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-09-22 13:38:21 +0000 |
commit | 5778c264349e762e3fd7642790049c5154f51b51 (patch) | |
tree | e6cd1e86c52214bd1f79161306d6d4130c191f3d /test/unit/time_entry_test.rb | |
parent | a66f5c45d3bd48490a6125ad99418d4413cff4ef (diff) | |
download | redmine-5778c264349e762e3fd7642790049c5154f51b51.tar.gz redmine-5778c264349e762e3fd7642790049c5154f51b51.zip |
add unit test to set project if project is nil at unit time entry test
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7452 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_test.rb')
-rw-r--r-- | test/unit/time_entry_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb index f207ecd92..97ec76ef1 100644 --- a/test/unit/time_entry_test.rb +++ b/test/unit/time_entry_test.rb @@ -110,6 +110,22 @@ class TimeEntryTest < ActiveSupport::TestCase assert_equal 1, te.errors.count end + def test_set_project_if_nil + 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 => 10, + :issue => issue, + :user => anon, + :activity => activity) + assert_equal project.id, te.project.id + end + context "#earilest_date_for_project" do setup do User.current = nil |