summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/wiki_controller_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb
index 737a29947..6bf93ea4f 100644
--- a/test/functional/wiki_controller_test.rb
+++ b/test/functional/wiki_controller_test.rb
@@ -177,6 +177,16 @@ class WikiControllerTest < ActionController::TestCase
assert_response 302
end
+ def test_show_page_without_content_should_display_the_edit_form
+ @request.session[:user_id] = 2
+ WikiPage.create!(:title => 'NoContent', :wiki => Project.find(1).wiki)
+
+ get :show, :project_id => 1, :id => 'NoContent'
+ assert_response :success
+ assert_template 'edit'
+ assert_select 'textarea[name=?]', 'content[text]'
+ end
+
def test_create_page
@request.session[:user_id] = 2
assert_difference 'WikiPage.count' do
@@ -412,6 +422,19 @@ class WikiControllerTest < ActionController::TestCase
assert_equal 2, c.version
end
+ def test_update_page_without_content_should_create_content
+ @request.session[:user_id] = 2
+ page = WikiPage.create!(:title => 'NoContent', :wiki => Project.find(1).wiki)
+
+ assert_no_difference 'WikiPage.count' do
+ assert_difference 'WikiContent.count' do
+ put :update, :project_id => 1, :id => 'NoContent', :content => {:text => 'Some content'}
+ assert_response 302
+ end
+ end
+ assert_equal 'Some content', page.reload.content.text
+ end
+
def test_update_section
@request.session[:user_id] = 2
page = WikiPage.find_by_title('Page_with_sections')