Commit d703440a authored by Michael Kozono's avatar Michael Kozono

Merge branch 'extend_branch_support_for_sse' into 'master'

Extend branch support for Static Site Editor

See merge request gitlab-org/gitlab!60848
parents 65fb8fb0 64a41655
---
title: Extend branch support for Static Site Editor
merge_request: 60848
author:
type: changed
...@@ -42,11 +42,11 @@ module Gitlab ...@@ -42,11 +42,11 @@ module Gitlab
end end
def supported_content? def supported_content?
master_branch? && extension_supported? && file_exists? branch_supported? && extension_supported? && file_exists?
end end
def master_branch? def branch_supported?
ref == 'master' ref.in?(%w[master main])
end end
def extension_supported? def extension_supported?
......
...@@ -54,13 +54,14 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do ...@@ -54,13 +54,14 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do
path, path,
'', '',
message: 'message', message: 'message',
branch_name: 'master' branch_name: ref
) )
end end
let(:ref) { 'main' }
let(:path) { 'README.md.erb' } let(:path) { 'README.md.erb' }
it { is_expected.to include(is_supported_content: true) } it { is_expected.to include(branch: ref, is_supported_content: true) }
end end
context 'when file path is nested' do context 'when file path is nested' do
...@@ -69,7 +70,7 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do ...@@ -69,7 +70,7 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do
it { is_expected.to include(base_url: '/namespace/project/-/sse/master%2Flib%2FREADME.md') } it { is_expected.to include(base_url: '/namespace/project/-/sse/master%2Flib%2FREADME.md') }
end end
context 'when branch is not master' do context 'when branch is not master or main' do
let(:ref) { 'my-branch' } let(:ref) { 'my-branch' }
it { is_expected.to include(is_supported_content: false) } it { is_expected.to include(is_supported_content: false) }
......
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