comparison test/functional/.svn/text-base/timelog_controller_test.rb.svn-base @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 94944d00e43c
children cbce1fd3b1b7
comparison
equal deleted inserted replaced
39:150ceac17a8d 119:8661b858af72
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software 16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 18
19 require File.dirname(__FILE__) + '/../test_helper' 19 require File.expand_path('../../test_helper', __FILE__)
20 require 'timelog_controller' 20 require 'timelog_controller'
21 21
22 # Re-raise errors caught by the controller. 22 # Re-raise errors caught by the controller.
23 class TimelogController; def rescue_action(e) raise e end; end 23 class TimelogController; def rescue_action(e) raise e end; end
24 24
92 assert_equal 7.3, t.hours 92 assert_equal 7.3, t.hours
93 assert_equal 3, t.user_id 93 assert_equal 3, t.user_id
94 assert_equal i, t.issue 94 assert_equal i, t.issue
95 assert_equal i.project, t.project 95 assert_equal i.project, t.project
96 end 96 end
97
98 def test_post_create_with_blank_issue
99 # TODO: should POST to issues’ time log instead of project. change form
100 # and routing
101 @request.session[:user_id] = 3
102 post :create, :project_id => 1,
103 :time_entry => {:comments => 'Some work on TimelogControllerTest',
104 # Not the default activity
105 :activity_id => '11',
106 :issue_id => '',
107 :spent_on => '2008-03-14',
108 :hours => '7.3'}
109 assert_redirected_to :action => 'index', :project_id => 'ecookbook'
110
111 t = TimeEntry.find_by_comments('Some work on TimelogControllerTest')
112 assert_not_nil t
113 assert_equal 11, t.activity_id
114 assert_equal 7.3, t.hours
115 assert_equal 3, t.user_id
116 end
97 117
98 def test_update 118 def test_update
99 entry = TimeEntry.find(1) 119 entry = TimeEntry.find(1)
100 assert_equal 1, entry.issue_id 120 assert_equal 1, entry.issue_id
101 assert_equal 2, entry.user_id 121 assert_equal 2, entry.user_id