Commit c45f9a20 authored by James Lopez's avatar James Lopez

Merge branch 'feature_create_an_endpoint_for_static_site_editor' into 'master'

Add an endpoint for Static Editor Editor

See merge request gitlab-org/gitlab!28689
parents 9bf6f182 34fd92dc
# frozen_string_literal: true
class Projects::StaticSiteEditorController < Projects::ApplicationController
layout 'fullscreen'
prepend_before_action :authenticate_user!, only: [:show]
def show
end
end
...@@ -67,6 +67,10 @@ scope format: false do ...@@ -67,6 +67,10 @@ scope format: false do
end end
end end
scope controller: :static_site_editor do
get '/sse/*id', action: :show, as: :show_sse
end
get '/tree/*id', to: 'tree#show', as: :tree get '/tree/*id', to: 'tree#show', as: :tree
get '/raw/*id', to: 'raw#show', as: :raw get '/raw/*id', to: 'raw#show', as: :raw
get '/blame/*id', to: 'blame#show', as: :blame get '/blame/*id', to: 'blame#show', as: :blame
......
...@@ -98,6 +98,7 @@ module Gitlab ...@@ -98,6 +98,7 @@ module Gitlab
preview preview
raw raw
refs refs
sse
tree tree
update update
wikis wikis
......
# frozen_string_literal: true
require 'spec_helper'
describe Projects::StaticSiteEditorController do
let(:project) { create(:project, :public, :repository) }
describe 'GET show' do
let(:default_params) do
{
namespace_id: project.namespace,
project_id: project,
id: 'master/README.md'
}
end
context 'User roles' do
context 'anonymous' do
before do
get :show, params: default_params
end
it 'redirects to sign in and returns' do
expect(response).to redirect_to(new_user_session_path)
end
end
%w[guest developer maintainer].each do |role|
context "as #{role}" do
let(:user) { create(:user) }
before do
project.add_role(user, role)
sign_in(user)
get :show, params: default_params
end
it 'renders the edit page' do
expect(response).to render_template(:show)
end
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment