mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
remove unused WikisController#edit (#26579)
git-svn-id: http://svn.redmine.org/redmine/trunk@17018 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -19,13 +19,6 @@ class WikisController < ApplicationController
|
|||||||
menu_item :settings
|
menu_item :settings
|
||||||
before_action :find_project, :authorize
|
before_action :find_project, :authorize
|
||||||
|
|
||||||
# Create or update a project's wiki
|
|
||||||
def edit
|
|
||||||
@wiki = @project.wiki || Wiki.new(:project => @project)
|
|
||||||
@wiki.safe_attributes = params[:wiki]
|
|
||||||
@wiki.save if request.post?
|
|
||||||
end
|
|
||||||
|
|
||||||
# Delete a project's wiki
|
# Delete a project's wiki
|
||||||
def destroy
|
def destroy
|
||||||
if request.post? && params[:confirm] && @project.wiki
|
if request.post? && params[:confirm] && @project.wiki
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ Rails.application.routes.draw do
|
|||||||
match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put, :patch]
|
match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put, :patch]
|
||||||
match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put, :patch]
|
match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put, :patch]
|
||||||
|
|
||||||
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
|
|
||||||
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
|
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
|
||||||
|
|
||||||
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
|
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
|
||||||
|
|||||||
@@ -24,47 +24,6 @@ class WikisControllerTest < Redmine::ControllerTest
|
|||||||
User.current = nil
|
User.current = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create
|
|
||||||
@request.session[:user_id] = 1
|
|
||||||
assert_nil Project.find(3).wiki
|
|
||||||
|
|
||||||
assert_difference 'Wiki.count' do
|
|
||||||
post :edit, :params => {:id => 3, :wiki => { :start_page => 'Start page' }}, :xhr => true
|
|
||||||
assert_response :success
|
|
||||||
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
|
|
||||||
post :edit, :params => {:id => 3, :wiki => { :start_page => '' }}, :xhr => true
|
|
||||||
assert_response :success
|
|
||||||
assert_equal 'text/javascript', response.content_type
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_include 'errorExplanation', response.body
|
|
||||||
assert_include "Start page cannot be blank", response.body
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_update
|
|
||||||
@request.session[:user_id] = 1
|
|
||||||
|
|
||||||
assert_no_difference 'Wiki.count' do
|
|
||||||
post :edit, :params => {:id => 1, :wiki => { :start_page => 'Other start page' }}, :xhr => true
|
|
||||||
assert_response :success
|
|
||||||
assert_equal 'text/javascript', response.content_type
|
|
||||||
end
|
|
||||||
|
|
||||||
wiki = Project.find(1).wiki
|
|
||||||
assert_equal 'Other start page', wiki.start_page
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_get_destroy_should_ask_confirmation
|
def test_get_destroy_should_ask_confirmation
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
assert_no_difference 'Wiki.count' do
|
assert_no_difference 'Wiki.count' do
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
class RoutingWikisTest < Redmine::RoutingTest
|
class RoutingWikisTest < Redmine::RoutingTest
|
||||||
def test_wikis
|
def test_wikis
|
||||||
should_route 'POST /projects/foo/wiki' => 'wikis#edit', :id => 'foo'
|
|
||||||
|
|
||||||
should_route 'GET /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
|
should_route 'GET /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
|
||||||
should_route 'POST /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
|
should_route 'POST /projects/foo/wiki/destroy' => 'wikis#destroy', :id => 'foo'
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user