summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
downloadgitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb')
-rw-r--r--spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb b/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
index c0629c8d795..3152dc2ad2f 100644
--- a/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
+++ b/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
@@ -3,10 +3,11 @@
require 'spec_helper'
RSpec.describe Gitlab::WikiPages::FrontMatterParser do
- subject(:parser) { described_class.new(raw_content) }
+ subject(:parser) { described_class.new(raw_content, gate) }
let(:content) { 'This is the content' }
let(:end_divider) { '---' }
+ let(:gate) { stub_feature_flag_gate('Gate') }
let(:with_front_matter) do
<<~MD
@@ -61,6 +62,32 @@ RSpec.describe Gitlab::WikiPages::FrontMatterParser do
it { is_expected.to have_attributes(reason: :no_match) }
end
+ context 'the feature flag is disabled' do
+ let(:raw_content) { with_front_matter }
+
+ before do
+ stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => false)
+ end
+
+ it { is_expected.to have_attributes(front_matter: be_empty, content: raw_content) }
+ end
+
+ context 'the feature flag is enabled for the gated object' do
+ let(:raw_content) { with_front_matter }
+
+ before do
+ stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => gate)
+ end
+
+ it do
+ is_expected.to have_attributes(
+ front_matter: have_correct_front_matter,
+ content: content + "\n",
+ reason: be_nil
+ )
+ end
+ end
+
context 'the end divider is ...' do
let(:end_divider) { '...' }
let(:raw_content) { with_front_matter }