Commit 9ff51129 authored by James Lopez's avatar James Lopez

Merge branch '235176_add_feature_flag_for_erb_support' into 'master'

Add `sse_erb_support` feature flag

Closes #235176

See merge request gitlab-org/gitlab!39195
parents 0803dc94 2f49dd66
---
name: sse_erb_support
introduced_by_url:
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/235460
group: group::static site editor
type: development
default_enabled: false
......@@ -3,7 +3,7 @@
module Gitlab
module StaticSiteEditor
class Config
SUPPORTED_EXTENSIONS = %w[.md .md.erb].freeze
SUPPORTED_EXTENSIONS = %w[.md].freeze
def initialize(repository, ref, file_path, return_url)
@repository = repository
......@@ -42,6 +42,8 @@ module Gitlab
end
def extension_supported?
return true if file_path.end_with?('.md.erb') && Feature.enabled?(:sse_erb_support, project)
SUPPORTED_EXTENSIONS.any? { |ext| file_path.end_with?(ext) }
end
......
......@@ -46,8 +46,6 @@ RSpec.describe Gitlab::StaticSiteEditor::Config do
end
context 'when file has .md.erb extension' do
let(:file_path) { 'README.md.erb' }
before do
repository.create_file(
project.creator,
......@@ -58,7 +56,25 @@ RSpec.describe Gitlab::StaticSiteEditor::Config do
)
end
it { is_expected.to include(is_supported_content: 'true') }
context 'when feature flag is enabled' do
let(:file_path) { 'FEATURE_ON.md.erb' }
before do
stub_feature_flags(sse_erb_support: project)
end
it { is_expected.to include(is_supported_content: 'true') }
end
context 'when feature flag is disabled' do
let(:file_path) { 'FEATURE_OFF.md.erb' }
before do
stub_feature_flags(sse_erb_support: false)
end
it { is_expected.to include(is_supported_content: 'false') }
end
end
context 'when file path is nested' do
......
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