@@ -300,6 +300,7 private | |||||
300 | render_error l(:error_no_tracker_in_project) |
|
300 | render_error l(:error_no_tracker_in_project) | |
301 | return false |
|
301 | return false | |
302 | end |
|
302 | end | |
|
303 | @issue.start_date ||= Date.today | |||
303 | if params[:issue].is_a?(Hash) |
|
304 | if params[:issue].is_a?(Hash) | |
304 | @issue.safe_attributes = params[:issue] |
|
305 | @issue.safe_attributes = params[:issue] | |
305 | if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record? |
|
306 | if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record? | |
@@ -307,7 +308,6 private | |||||
307 | end |
|
308 | end | |
308 | end |
|
309 | end | |
309 | @issue.author = User.current |
|
310 | @issue.author = User.current | |
310 | @issue.start_date ||= Date.today |
|
|||
311 | @priorities = IssuePriority.all |
|
311 | @priorities = IssuePriority.all | |
312 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true) |
|
312 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true) | |
313 | end |
|
313 | end |
@@ -382,6 +382,7 class IssuesControllerTest < ActionController::TestCase | |||||
382 | :subject => 'This is the test_new issue', |
|
382 | :subject => 'This is the test_new issue', | |
383 | :description => 'This is the description', |
|
383 | :description => 'This is the description', | |
384 | :priority_id => 5, |
|
384 | :priority_id => 5, | |
|
385 | :start_date => '2010-11-07', | |||
385 | :estimated_hours => '', |
|
386 | :estimated_hours => '', | |
386 | :custom_field_values => {'2' => 'Value for field 2'}} |
|
387 | :custom_field_values => {'2' => 'Value for field 2'}} | |
387 | end |
|
388 | end | |
@@ -392,12 +393,33 class IssuesControllerTest < ActionController::TestCase | |||||
392 | assert_equal 2, issue.author_id |
|
393 | assert_equal 2, issue.author_id | |
393 | assert_equal 3, issue.tracker_id |
|
394 | assert_equal 3, issue.tracker_id | |
394 | assert_equal 2, issue.status_id |
|
395 | assert_equal 2, issue.status_id | |
|
396 | assert_equal Date.parse('2010-11-07'), issue.start_date | |||
395 | assert_nil issue.estimated_hours |
|
397 | assert_nil issue.estimated_hours | |
396 | v = issue.custom_values.find(:first, :conditions => {:custom_field_id => 2}) |
|
398 | v = issue.custom_values.find(:first, :conditions => {:custom_field_id => 2}) | |
397 | assert_not_nil v |
|
399 | assert_not_nil v | |
398 | assert_equal 'Value for field 2', v.value |
|
400 | assert_equal 'Value for field 2', v.value | |
399 | end |
|
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 | def test_post_create_and_continue |
|
423 | def test_post_create_and_continue | |
402 | @request.session[:user_id] = 2 |
|
424 | @request.session[:user_id] = 2 | |
403 | post :create, :project_id => 1, |
|
425 | post :create, :project_id => 1, |
General Comments 0
You need to be logged in to leave comments.
Login now