Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
4f2d77dae1
commit
207ec5c078
12 changed files with 182 additions and 135 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
module WikiActions
|
||||
include DiffHelper
|
||||
include PreviewMarkdown
|
||||
include SendsBlob
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
extend ActiveSupport::Concern
|
||||
|
|
|
@ -81,10 +81,6 @@ class Projects::ApplicationController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def apply_diff_view_cookie!
|
||||
set_secure_cookie(:diff_view, params.delete(:view), type: COOKIE_TYPE_PERMANENT) if params[:view].present?
|
||||
end
|
||||
|
||||
def require_pages_enabled!
|
||||
not_found unless @project.pages_available?
|
||||
end
|
||||
|
|
|
@ -9,6 +9,7 @@ class Projects::BlobController < Projects::ApplicationController
|
|||
include ActionView::Helpers::SanitizeHelper
|
||||
include RedirectsForMissingPathOnTree
|
||||
include SourcegraphDecorator
|
||||
include DiffHelper
|
||||
|
||||
prepend_before_action :authenticate_user!, only: [:edit]
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
class Projects::WikisController < Projects::ApplicationController
|
||||
include WikiActions
|
||||
include PreviewMarkdown
|
||||
|
||||
alias_method :container, :project
|
||||
|
||||
|
|
|
@ -174,6 +174,10 @@ module DiffHelper
|
|||
end
|
||||
end
|
||||
|
||||
def apply_diff_view_cookie!
|
||||
set_secure_cookie(:diff_view, params.delete(:view), type: CookiesHelper::COOKIE_TYPE_PERMANENT) if params[:view].present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def diff_btn(title, name, selected)
|
||||
|
|
|
@ -3,7 +3,7 @@ scope(controller: :wikis) do
|
|||
get :git_access
|
||||
get :pages
|
||||
get :new
|
||||
get '/', to: redirect('%{namespace_id}/%{project_id}/wikis/home')
|
||||
get '/', to: redirect { |params, request| "#{request.path}/home" }
|
||||
post '/', to: 'wikis#create'
|
||||
end
|
||||
|
||||
|
|
|
@ -85,9 +85,11 @@ module Gitlab
|
|||
def wiki_url(wiki, **options)
|
||||
return wiki_page_url(wiki, Wiki::HOMEPAGE, **options) unless options[:action]
|
||||
|
||||
options[:controller] = 'projects/wikis'
|
||||
options[:namespace_id] = wiki.container.namespace
|
||||
options[:project_id] = wiki.container
|
||||
if wiki.container.is_a?(Project)
|
||||
options[:controller] = 'projects/wikis'
|
||||
options[:namespace_id] = wiki.container.namespace
|
||||
options[:project_id] = wiki.container
|
||||
end
|
||||
|
||||
instance.url_for(**options)
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'spec_helper'
|
|||
|
||||
RSpec.describe Projects::WikisController do
|
||||
it_behaves_like 'wiki controller actions' do
|
||||
let(:container) { create(:project, :public, :repository, namespace: user.namespace) }
|
||||
let(:container) { create(:project, :public, namespace: user.namespace) }
|
||||
let(:routing_params) { { namespace_id: container.namespace, project_id: container } }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,71 +3,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
RSpec.describe 'project routing' do
|
||||
let(:base_params) { { namespace_id: 'gitlab', project_id: 'gitlabhq' } }
|
||||
|
||||
before do
|
||||
allow(Project).to receive(:find_by_full_path).and_return(false)
|
||||
allow(Project).to receive(:find_by_full_path).with('gitlab/gitlabhq', any_args).and_return(true)
|
||||
end
|
||||
|
||||
# Shared examples for a resource inside a Project
|
||||
#
|
||||
# By default it tests all the default REST actions: index, create, new, edit,
|
||||
# show, update, and destroy. You can remove actions by customizing the
|
||||
# `actions` variable.
|
||||
#
|
||||
# It also expects a `controller` variable to be available which defines both
|
||||
# the path to the resource as well as the controller name.
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# # Default behavior
|
||||
# it_behaves_like 'RESTful project resources' do
|
||||
# let(:controller) { 'issues' }
|
||||
# end
|
||||
#
|
||||
# # Customizing actions
|
||||
# it_behaves_like 'RESTful project resources' do
|
||||
# let(:actions) { [:index] }
|
||||
# let(:controller) { 'issues' }
|
||||
# end
|
||||
#
|
||||
# # Different controller name and path
|
||||
# it_behaves_like 'RESTful project resources' do
|
||||
# let(:controller) { 'pages_domains' }
|
||||
# let(:controller_path) { 'pages/domains' }
|
||||
# end
|
||||
shared_examples 'RESTful project resources' do
|
||||
let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] }
|
||||
let(:controller_path) { controller }
|
||||
|
||||
it 'to #index' do
|
||||
expect(get("/gitlab/gitlabhq/#{controller_path}")).to route_to("projects/#{controller}#index", namespace_id: 'gitlab', project_id: 'gitlabhq') if actions.include?(:index)
|
||||
end
|
||||
|
||||
it 'to #create' do
|
||||
expect(post("/gitlab/gitlabhq/#{controller_path}")).to route_to("projects/#{controller}#create", namespace_id: 'gitlab', project_id: 'gitlabhq') if actions.include?(:create)
|
||||
end
|
||||
|
||||
it 'to #new' do
|
||||
expect(get("/gitlab/gitlabhq/#{controller_path}/new")).to route_to("projects/#{controller}#new", namespace_id: 'gitlab', project_id: 'gitlabhq') if actions.include?(:new)
|
||||
end
|
||||
|
||||
it 'to #edit' do
|
||||
expect(get("/gitlab/gitlabhq/#{controller_path}/1/edit")).to route_to("projects/#{controller}#edit", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:edit)
|
||||
end
|
||||
|
||||
it 'to #show' do
|
||||
expect(get("/gitlab/gitlabhq/#{controller_path}/1")).to route_to("projects/#{controller}#show", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:show)
|
||||
end
|
||||
|
||||
it 'to #update' do
|
||||
expect(put("/gitlab/gitlabhq/#{controller_path}/1")).to route_to("projects/#{controller}#update", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:update)
|
||||
end
|
||||
|
||||
it 'to #destroy' do
|
||||
expect(delete("/gitlab/gitlabhq/#{controller_path}/1")).to route_to("projects/#{controller}#destroy", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:destroy)
|
||||
end
|
||||
end
|
||||
|
||||
# projects POST /projects(.:format) projects#create
|
||||
# new_project GET /projects/new(.:format) projects#new
|
||||
# files_project GET /:id/files(.:format) projects#files
|
||||
|
@ -149,25 +91,19 @@ RSpec.describe 'project routing' do
|
|||
end
|
||||
end
|
||||
|
||||
# pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages
|
||||
# history_project_wiki GET /:project_id/wikis/:id/history(.:format) projects/wikis#history
|
||||
# project_wikis POST /:project_id/wikis(.:format) projects/wikis#create
|
||||
# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) projects/wikis#edit
|
||||
# project_wiki GET /:project_id/wikis/:id(.:format) projects/wikis#show
|
||||
# DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy
|
||||
# project_wikis_git_access GET /:project_id/-/wikis/git_access(.:format) projects/wikis#git_access
|
||||
# project_wikis_pages GET /:project_id/-/wikis/pages(.:format) projects/wikis#pages
|
||||
# project_wikis_new GET /:project_id/-/wikis/new(.:format) projects/wikis#new
|
||||
# POST /:project_id/-/wikis(.:format) projects/wikis#create
|
||||
# project_wiki_edit GET /:project_id/-/wikis/*id/edit projects/wikis#edit
|
||||
# project_wiki_history GET /:project_id/-/wikis/*id/history projects/wikis#history
|
||||
# project_wiki_preview_markdown POST /:project_id/-/wikis/*id/preview_markdown projects/wikis#preview_markdown
|
||||
# project_wiki GET /:project_id/-/wikis/*id projects/wikis#show
|
||||
# PUT /:project_id/-/wikis/*id projects/wikis#update
|
||||
# DELETE /:project_id/-/wikis/*id projects/wikis#destroy
|
||||
describe Projects::WikisController, 'routing' do
|
||||
it 'to #pages' do
|
||||
expect(get('/gitlab/gitlabhq/-/wikis/pages')).to route_to('projects/wikis#pages', namespace_id: 'gitlab', project_id: 'gitlabhq')
|
||||
end
|
||||
|
||||
it 'to #history' do
|
||||
expect(get('/gitlab/gitlabhq/-/wikis/1/history')).to route_to('projects/wikis#history', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
|
||||
end
|
||||
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:create, :edit, :show, :destroy] }
|
||||
let(:controller) { 'wikis' }
|
||||
let(:controller_path) { '/-/wikis' }
|
||||
it_behaves_like 'wiki routing' do
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/wikis' }
|
||||
end
|
||||
|
||||
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/wikis", "/gitlab/gitlabhq/-/wikis"
|
||||
|
@ -246,10 +182,9 @@ RSpec.describe 'project routing' do
|
|||
# project_deploy_key PATCH /:project_id/deploy_keys/:id(.:format) deploy_keys#update
|
||||
# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy
|
||||
describe Projects::DeployKeysController, 'routing' do
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:index, :new, :create, :edit, :update] }
|
||||
let(:controller) { 'deploy_keys' }
|
||||
let(:controller_path) { '/-/deploy_keys' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index new create edit update] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/deploy_keys' }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -257,10 +192,9 @@ RSpec.describe 'project routing' do
|
|||
# POST /:project_id/protected_branches(.:format) protected_branches#create
|
||||
# project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy
|
||||
describe Projects::ProtectedBranchesController, 'routing' do
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:index, :create, :destroy] }
|
||||
let(:controller) { 'protected_branches' }
|
||||
let(:controller_path) { '/-/protected_branches' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index create destroy] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/protected_branches' }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -320,10 +254,9 @@ RSpec.describe 'project routing' do
|
|||
expect(get('/gitlab/gitlabhq/-/merge_requests/1/diffs')).to route_to('projects/merge_requests#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1', tab: 'diffs')
|
||||
end
|
||||
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:controller) { 'merge_requests' }
|
||||
let(:actions) { [:index, :edit, :show, :update] }
|
||||
let(:controller_path) { '/-/merge_requests' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index edit show update] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/merge_requests' }
|
||||
end
|
||||
|
||||
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/merge_requests", "/gitlab/gitlabhq/-/merge_requests"
|
||||
|
@ -428,9 +361,9 @@ RSpec.describe 'project routing' do
|
|||
expect(post('/gitlab/gitlabhq/hooks/1/test')).to route_to('projects/hooks#test', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
|
||||
end
|
||||
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:index, :create, :destroy, :edit, :update] }
|
||||
let(:controller) { 'hooks' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index create destroy edit update] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/hooks' }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -465,10 +398,9 @@ RSpec.describe 'project routing' do
|
|||
# POST /:project_id/commits(.:format) commits#create
|
||||
# project_commit GET /:project_id/commits/:id(.:format) commits#show
|
||||
describe Projects::CommitsController, 'routing' do
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:show] }
|
||||
let(:controller) { 'commits' }
|
||||
let(:controller_path) { '/-/commits' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[show] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/commits' }
|
||||
end
|
||||
|
||||
it 'to #show' do
|
||||
|
@ -485,10 +417,9 @@ RSpec.describe 'project routing' do
|
|||
# PUT /:project_id/project_members/:id(.:format) project_members#update
|
||||
# DELETE /:project_id/project_members/:id(.:format) project_members#destroy
|
||||
describe Projects::ProjectMembersController, 'routing' do
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:index, :create, :update, :destroy] }
|
||||
let(:controller) { 'project_members' }
|
||||
let(:controller_path) { '/-/project_members' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index create update destroy] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/project_members' }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -501,10 +432,9 @@ RSpec.describe 'project routing' do
|
|||
# DELETE /:project_id/milestones/:id(.:format) milestones#destroy
|
||||
# promote_project_milestone POST /:project_id/milestones/:id/promote milestones#promote
|
||||
describe Projects::MilestonesController, 'routing' do
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:controller) { 'milestones' }
|
||||
let(:actions) { [:index, :create, :new, :edit, :show, :update] }
|
||||
let(:controller_path) { '/-/milestones' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index create new edit show update] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/milestones' }
|
||||
end
|
||||
|
||||
it 'to #promote' do
|
||||
|
@ -534,10 +464,9 @@ RSpec.describe 'project routing' do
|
|||
expect(post('/gitlab/gitlabhq/-/issues/bulk_update')).to route_to('projects/issues#bulk_update', namespace_id: 'gitlab', project_id: 'gitlabhq')
|
||||
end
|
||||
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:controller) { 'issues' }
|
||||
let(:actions) { [:index, :create, :new, :edit, :show, :update] }
|
||||
let(:controller_path) { '/-/issues' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[index create new edit show update] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/-/issues' }
|
||||
end
|
||||
|
||||
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/issues", "/gitlab/gitlabhq/-/issues"
|
||||
|
@ -558,9 +487,9 @@ RSpec.describe 'project routing' do
|
|||
)
|
||||
end
|
||||
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:create, :destroy] }
|
||||
let(:controller) { 'notes' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[create destroy] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/notes' }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -749,10 +678,10 @@ RSpec.describe 'project routing' do
|
|||
end
|
||||
|
||||
describe Projects::PagesDomainsController, 'routing' do
|
||||
it_behaves_like 'RESTful project resources' do
|
||||
let(:actions) { [:show, :new, :create, :destroy] }
|
||||
let(:controller) { 'pages_domains' }
|
||||
let(:controller_path) { 'pages/domains' }
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:actions) { %i[show new create destroy] }
|
||||
let(:base_path) { '/gitlab/gitlabhq/pages/domains' }
|
||||
let(:id) { 'my.domain.com' }
|
||||
end
|
||||
|
||||
it 'to #destroy with a valid domain name' do
|
||||
|
|
|
@ -147,6 +147,7 @@ RSpec.shared_examples 'wiki controller actions' do
|
|||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('shared/wikis/show')
|
||||
expect(assigns(:page).title).to eq(wiki_title)
|
||||
expect(assigns(:sidebar_wiki_entries)).to contain_exactly(an_instance_of(WikiPage))
|
||||
expect(assigns(:sidebar_limited)).to be(false)
|
||||
|
@ -159,6 +160,7 @@ RSpec.shared_examples 'wiki controller actions' do
|
|||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('shared/wikis/show')
|
||||
expect(flash[:notice]).to eq(_('The content of this page is not encoded in UTF-8. Edits can only be made via the Git repository.'))
|
||||
end
|
||||
end
|
||||
|
@ -167,19 +169,37 @@ RSpec.shared_examples 'wiki controller actions' do
|
|||
context 'when the page does not exist' do
|
||||
let(:id) { 'does not exist' }
|
||||
|
||||
before do
|
||||
subject
|
||||
context 'when the user can create pages' do
|
||||
before do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('shared/wikis/edit')
|
||||
end
|
||||
|
||||
it 'builds a new wiki page with the id as the title' do
|
||||
expect(assigns(:page).title).to eq(id)
|
||||
end
|
||||
|
||||
context 'when a random_title param is present' do
|
||||
let(:random_title) { true }
|
||||
|
||||
it 'builds a new wiki page with no title' do
|
||||
expect(assigns(:page).title).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'builds a new wiki page with the id as the title' do
|
||||
expect(assigns(:page).title).to eq(id)
|
||||
end
|
||||
context 'when the user cannot create pages' do
|
||||
before do
|
||||
sign_out(:user)
|
||||
end
|
||||
|
||||
context 'when a random_title param is present' do
|
||||
let(:random_title) { true }
|
||||
it 'shows the empty state' do
|
||||
subject
|
||||
|
||||
it 'builds a new wiki page with no title' do
|
||||
expect(assigns(:page).title).to be_empty
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template('shared/wikis/empty')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -195,6 +215,7 @@ RSpec.shared_examples 'wiki controller actions' do
|
|||
it 'delivers the file with the correct headers' do
|
||||
subject
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response.headers['Content-Disposition']).to match(/^inline/)
|
||||
expect(response.headers[Gitlab::Workhorse::DETECT_HEADER]).to eq('true')
|
||||
expect(response.cache_control[:public]).to be(false)
|
||||
|
@ -208,6 +229,7 @@ RSpec.shared_examples 'wiki controller actions' do
|
|||
it 'renders json in a correct format' do
|
||||
post :preview_markdown, params: routing_params.merge(id: 'page/path', text: '*Markdown* text')
|
||||
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(json_response.keys).to match_array(%w(body references))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Shared examples for resource routes.
|
||||
#
|
||||
# By default it tests all the default REST actions: index, create, new, edit,
|
||||
# show, update, and destroy. You can remove actions by customizing the
|
||||
# `actions` variable.
|
||||
#
|
||||
# The subject is expected to be an instance of the controller under test.
|
||||
#
|
||||
# It also expects a `base_path` variable to be available which defines the
|
||||
# base path of the controller, and a `base_params` variable which
|
||||
# defines the route params the base path maps to.
|
||||
#
|
||||
# Examples
|
||||
#
|
||||
# # Default behavior
|
||||
# describe Projects::CommitsController, 'routing' do
|
||||
# it_behaves_like 'resource routing' do
|
||||
# let(:base_path) { '/gitlab/gitlabhq/-/commits' }
|
||||
# let(:base_params) { { namespace_id: 'gitlab', project_id: 'gitlabhq' } }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# # Customizing actions
|
||||
# it_behaves_like 'resource routing' do
|
||||
# let(:base_path) { '/gitlab/gitlabhq/-/commits' }
|
||||
#
|
||||
# # Specify default actions
|
||||
# let(:actions) { [:index] }
|
||||
#
|
||||
# # Add custom actions by passing a hash with action names
|
||||
# # as keys, and the HTTP method and path as values.
|
||||
# let(:additional_actions) do
|
||||
# {
|
||||
# preview_markdown: [:post, '/:id/preview_markdown'],
|
||||
# }
|
||||
# end
|
||||
# end
|
||||
RSpec.shared_examples 'resource routing' do
|
||||
let(:controller) { described_class.controller_path }
|
||||
let(:id) { '123' }
|
||||
|
||||
let(:default_actions) do
|
||||
{
|
||||
index: [:get, ''],
|
||||
show: [:get, '/:id'],
|
||||
new: [:get, '/new'],
|
||||
create: [:post, ''],
|
||||
edit: [:get, '/:id/edit'],
|
||||
update: [:put, '/:id'],
|
||||
destroy: [:delete, '/:id']
|
||||
}
|
||||
end
|
||||
|
||||
let(:actions) { default_actions.keys }
|
||||
let(:additional_actions) { {} }
|
||||
|
||||
it 'routes resource actions', :aggregate_failures do
|
||||
selected_actions = default_actions.slice(*actions).merge(additional_actions)
|
||||
|
||||
selected_actions.each do |action, (method, action_path)|
|
||||
expected_params = base_params.merge(controller: controller.to_s, action: action.to_s)
|
||||
|
||||
if action_path.include?(':id')
|
||||
action_path = action_path.sub(':id', id)
|
||||
expected_params[:id] = id
|
||||
end
|
||||
|
||||
expect(public_send(method, "#{base_path}#{action_path}")).to route_to(expected_params)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.shared_examples 'wiki routing' do
|
||||
it_behaves_like 'resource routing' do
|
||||
let(:id) { 'directory/page' }
|
||||
let(:actions) { %i[show new create edit update destroy] }
|
||||
let(:additional_actions) do
|
||||
{
|
||||
pages: [:get, '/pages'],
|
||||
history: [:get, '/:id/history'],
|
||||
git_access: [:get, '/git_access'],
|
||||
preview_markdown: [:post, '/:id/preview_markdown']
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it 'redirects the base path to the home page', type: :request do
|
||||
expect(get(base_path)).to redirect_to("#{base_path}/home")
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue