##// END OF EJS Templates
Merged r4378 from trunk....
Jean-Philippe Lang -
r4284:2b9a5bf6e2d0
parent child
Show More
@@ -300,6 +300,7 private
300 300 render_error l(:error_no_tracker_in_project)
301 301 return false
302 302 end
303 @issue.start_date ||= Date.today
303 304 if params[:issue].is_a?(Hash)
304 305 @issue.safe_attributes = params[:issue]
305 306 if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record?
@@ -307,7 +308,6 private
307 308 end
308 309 end
309 310 @issue.author = User.current
310 @issue.start_date ||= Date.today
311 311 @priorities = IssuePriority.all
312 312 @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
313 313 end
@@ -382,6 +382,7 class IssuesControllerTest < ActionController::TestCase
382 382 :subject => 'This is the test_new issue',
383 383 :description => 'This is the description',
384 384 :priority_id => 5,
385 :start_date => '2010-11-07',
385 386 :estimated_hours => '',
386 387 :custom_field_values => {'2' => 'Value for field 2'}}
387 388 end
@@ -392,12 +393,33 class IssuesControllerTest < ActionController::TestCase
392 393 assert_equal 2, issue.author_id
393 394 assert_equal 3, issue.tracker_id
394 395 assert_equal 2, issue.status_id
396 assert_equal Date.parse('2010-11-07'), issue.start_date
395 397 assert_nil issue.estimated_hours
396 398 v = issue.custom_values.find(:first, :conditions => {:custom_field_id => 2})
397 399 assert_not_nil v
398 400 assert_equal 'Value for field 2', v.value
399 401 end
400 402
403 def test_post_create_without_start_date
404 @request.session[:user_id] = 2
405 assert_difference 'Issue.count' do
406 post :create, :project_id => 1,
407 :issue => {:tracker_id => 3,
408 :status_id => 2,
409 :subject => 'This is the test_new issue',
410 :description => 'This is the description',
411 :priority_id => 5,
412 :start_date => '',
413 :estimated_hours => '',
414 :custom_field_values => {'2' => 'Value for field 2'}}
415 end
416 assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
417
418 issue = Issue.find_by_subject('This is the test_new issue')
419 assert_not_nil issue
420 assert_nil issue.start_date
421 end
422
401 423 def test_post_create_and_continue
402 424 @request.session[:user_id] = 2
403 425 post :create, :project_id => 1,
General Comments 0
You need to be logged in to leave comments. Login now