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