]> source.dussan.org Git - redmine.git/commitdiff
use with_settings at test_post_create_without_start_date_and_default_start_date_is_cr...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 10 May 2013 04:37:42 +0000 (04:37 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 10 May 2013 04:37:42 +0000 (04:37 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11821 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/issues_controller_test.rb

index 1143cef697ad3a70cff9b531a3932cdda3944697..b0dc58634caee81d68535bd5a919889d6d13c68b 100644 (file)
@@ -1788,11 +1788,10 @@ class IssuesControllerTest < ActionController::TestCase
   end
 
   def test_post_create_without_start_date_and_default_start_date_is_creation_date
-    Setting.default_issue_start_date_to_creation_date = 1
-
-    @request.session[:user_id] = 2
-    assert_difference 'Issue.count' do
-      post :create, :project_id => 1,
+    with_settings :default_issue_start_date_to_creation_date  => 1 do
+      @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',
@@ -1800,12 +1799,13 @@ class IssuesControllerTest < ActionController::TestCase
                             :priority_id => 5,
                             :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_equal Date.today, issue.start_date
     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_equal Date.today, issue.start_date
   end
 
   def test_post_create_and_continue