Removes RJS from WikisController.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10051 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-07-19 18:13:08 +00:00
parent 5b6732cfaf
commit dee586e9eb
3 changed files with 37 additions and 3 deletions

View File

@ -24,7 +24,6 @@ class WikisController < ApplicationController
@wiki = @project.wiki || Wiki.new(:project => @project)
@wiki.safe_attributes = params[:wiki]
@wiki.save if request.post?
render(:update) {|page| page.replace_html "tab-content-wiki", :partial => 'projects/settings/wiki'}
end
# Delete a project's wiki

View File

@ -0,0 +1 @@
Element.update('tab-content-wiki', '<%= escape_javascript(render :partial => 'projects/settings/wiki') %>');

View File

@ -34,13 +34,47 @@ class WikisControllerTest < ActionController::TestCase
def test_create
@request.session[:user_id] = 1
assert_nil Project.find(3).wiki
post :edit, :id => 3, :wiki => { :start_page => 'Start page' }
assert_response :success
assert_difference 'Wiki.count' do
xhr :post, :edit, :id => 3, :wiki => { :start_page => 'Start page' }
assert_response :success
assert_template 'edit'
assert_equal 'text/javascript', response.content_type
end
wiki = Project.find(3).wiki
assert_not_nil wiki
assert_equal 'Start page', wiki.start_page
end
def test_create_with_failure
@request.session[:user_id] = 1
assert_no_difference 'Wiki.count' do
xhr :post, :edit, :id => 3, :wiki => { :start_page => '' }
assert_response :success
assert_template 'edit'
assert_equal 'text/javascript', response.content_type
end
assert_include 'errorExplanation', response.body
assert_include 'Start page can\\\'t be blank', response.body
end
def test_update
@request.session[:user_id] = 1
assert_no_difference 'Wiki.count' do
xhr :post, :edit, :id => 1, :wiki => { :start_page => 'Other start page' }
assert_response :success
assert_template 'edit'
assert_equal 'text/javascript', response.content_type
end
wiki = Project.find(1).wiki
assert_equal 'Other start page', wiki.start_page
end
def test_destroy
@request.session[:user_id] = 1
post :destroy, :id => 1, :confirm => 1