Commit 64a41655 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Extend branch support for Static Site Editor

Allow to use both `main` and `master` branches

Changelog: changed
parent 2df8eb00
---
title: Extend branch support for Static Site Editor
merge_request: 60848
author:
type: changed
......@@ -42,11 +42,11 @@ module Gitlab
end
def supported_content?
master_branch? && extension_supported? && file_exists?
branch_supported? && extension_supported? && file_exists?
end
def master_branch?
ref == 'master'
def branch_supported?
ref.in?(%w[master main])
end
def extension_supported?
......
......@@ -54,13 +54,14 @@ RSpec.describe Gitlab::StaticSiteEditor::Config::GeneratedConfig do
path,
'',
message: 'message',
branch_name: 'master'
branch_name: ref
)
end
let(:ref) { 'main' }
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
context 'when file path is nested' 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') }
end
context 'when branch is not master' do
context 'when branch is not master or main' do
let(:ref) { 'my-branch' }
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