]> source.dussan.org Git - redmine.git/commitdiff
Merged r10219 from trunk to 1.4-stable (#11665)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 21 Aug 2012 17:16:28 +0000 (17:16 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 21 Aug 2012 17:16:28 +0000 (17:16 +0000)
add functional test to create non default document category.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10227 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/documents_controller_test.rb

index 70b2457d1fabac8c9788ceff5e3eb6255ce99013..1444a74e2cd0ee2df6d39c9221bae0c8aaa8aed7 100644 (file)
@@ -126,6 +126,23 @@ LOREM
     assert_template 'new'
   end
 
+  def test_create_non_default_category
+    @request.session[:user_id] = 2
+    category2 = Enumeration.find_by_name('User documentation')
+    category2.update_attributes(:is_default => true)
+    category1 = Enumeration.find_by_name('Uncategorized')
+    post :create,
+         :project_id => 'ecookbook',
+         :document => { :title => 'no default',
+                        :description => 'This is a new document',
+                        :category_id => category1.id }
+    assert_redirected_to '/projects/ecookbook/documents'
+    doc = Document.find_by_title('no default')
+    assert_not_nil doc
+    assert_equal category1.id, doc.category_id
+    assert_equal category1, doc.category
+  end
+
   def test_edit
     @request.session[:user_id] = 2
     get :edit, :id => 1