Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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 }