diff test/functional/timelog_controller_test.rb @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 94944d00e43c
children cbce1fd3b1b7
line wrap: on
line diff
--- a/test/functional/timelog_controller_test.rb	Fri Nov 19 14:05:24 2010 +0000
+++ b/test/functional/timelog_controller_test.rb	Thu Jan 13 14:12:06 2011 +0000
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-require File.dirname(__FILE__) + '/../test_helper'
+require File.expand_path('../../test_helper', __FILE__)
 require 'timelog_controller'
 
 # Re-raise errors caught by the controller.
@@ -94,6 +94,26 @@
     assert_equal i, t.issue
     assert_equal i.project, t.project
   end
+
+  def test_post_create_with_blank_issue
+    # TODO: should POST to issues’ time log instead of project. change form
+    # and routing
+    @request.session[:user_id] = 3
+    post :create, :project_id => 1,
+                :time_entry => {:comments => 'Some work on TimelogControllerTest',
+                                # Not the default activity
+                                :activity_id => '11',
+                                :issue_id => '',
+                                :spent_on => '2008-03-14',
+                                :hours => '7.3'}
+    assert_redirected_to :action => 'index', :project_id => 'ecookbook'
+    
+    t = TimeEntry.find_by_comments('Some work on TimelogControllerTest')
+    assert_not_nil t
+    assert_equal 11, t.activity_id
+    assert_equal 7.3, t.hours
+    assert_equal 3, t.user_id
+  end
   
   def test_update
     entry = TimeEntry.find(1)