diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-11-14 11:15:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-11-14 11:15:53 +0000 |
commit | 2b9a5bf6e2d034afb2096202ee144e049ba2cceb (patch) | |
tree | cf5148de45bf855a5f9113f30053b6de9306e4b7 | |
parent | d3b536e9a60cdf42d244d5bc48fae4b3a69a774f (diff) | |
download | redmine-2b9a5bf6e2d034afb2096202ee144e049ba2cceb.tar.gz redmine-2b9a5bf6e2d034afb2096202ee144e049ba2cceb.zip |
Merged r4378 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4398 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/issues_controller.rb | 2 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index c11971ac2..df5a356a2 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -300,6 +300,7 @@ private render_error l(:error_no_tracker_in_project) return false end + @issue.start_date ||= Date.today if params[:issue].is_a?(Hash) @issue.safe_attributes = params[:issue] if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record? @@ -307,7 +308,6 @@ private end end @issue.author = User.current - @issue.start_date ||= Date.today @priorities = IssuePriority.all @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true) end diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 9e70233b2..0376aed28 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -382,6 +382,7 @@ class IssuesControllerTest < ActionController::TestCase :subject => 'This is the test_new issue', :description => 'This is the description', :priority_id => 5, + :start_date => '2010-11-07', :estimated_hours => '', :custom_field_values => {'2' => 'Value for field 2'}} end @@ -392,12 +393,33 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 2, issue.author_id assert_equal 3, issue.tracker_id assert_equal 2, issue.status_id + assert_equal Date.parse('2010-11-07'), issue.start_date assert_nil issue.estimated_hours v = issue.custom_values.find(:first, :conditions => {:custom_field_id => 2}) assert_not_nil v assert_equal 'Value for field 2', v.value end + def test_post_create_without_start_date + @request.session[:user_id] = 2 + assert_difference 'Issue.count' do + post :create, :project_id => 1, + :issue => {:tracker_id => 3, + :status_id => 2, + :subject => 'This is the test_new issue', + :description => 'This is the description', + :priority_id => 5, + :start_date => '', + :estimated_hours => '', + :custom_field_values => {'2' => 'Value for field 2'}} + end + assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id + + issue = Issue.find_by_subject('This is the test_new issue') + assert_not_nil issue + assert_nil issue.start_date + end + def test_post_create_and_continue @request.session[:user_id] = 2 post :create, :project_id => 1, |