summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-17 15:02:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-17 15:02:28 +0000
commit849463558da4b9291b68900ef0bf7623c325e8fd (patch)
tree0a13c910c1349f4db26054523c35de1cb47ddd04
parent606c5f3093a8d5b046fdc370b777809b19929238 (diff)
downloadredmine-849463558da4b9291b68900ef0bf7623c325e8fd.tar.gz
redmine-849463558da4b9291b68900ef0bf7623c325e8fd.zip
Additional tests for WikiController.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8262 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/functional/wiki_controller_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 80a0311f6..8f8f81759 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -273,6 +273,26 @@ class WikiControllerTest < ActionController::TestCase
assert_tag :tag => 'input', :attributes => {:id => 'content_version', :value => '1'}
end
+ def test_update_page_with_attachments_only_should_not_create_content_version
+ @request.session[:user_id] = 2
+ assert_no_difference 'WikiPage.count' do
+ assert_no_difference 'WikiContent.count' do
+ assert_no_difference 'WikiContent::Version.count' do
+ assert_difference 'Attachment.count' do
+ put :update, :project_id => 1,
+ :id => 'Another_page',
+ :content => {
+ :comments => '',
+ :text => Wiki.find(1).find_page('Another_page').content.text,
+ :version => 1
+ },
+ :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ end
+ end
+ end
+ end
+ end
+
def test_update_stale_page_should_not_raise_an_error
@request.session[:user_id] = 2
c = Wiki.find(1).find_page('Another_page').content
@@ -736,4 +756,14 @@ class WikiControllerTest < ActionController::TestCase
get :history, :project_id => 1, :id => 'Unknown_page'
assert_response 404
end
+
+ def test_add_attachment
+ @request.session[:user_id] = 2
+ assert_difference 'Attachment.count' do
+ post :add_attachment, :project_id => 1, :id => 'CookBook_documentation',
+ :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+ end
+ attachment = Attachment.first(:order => 'id DESC')
+ assert_equal Wiki.find(1).find_page('CookBook_documentation'), attachment.container
+ end
end