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