diff options
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r-- | spec/models/wiki_page_spec.rb | 57 |
1 files changed, 3 insertions, 54 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 699dd35196f..0016d2f517b 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -24,14 +24,6 @@ RSpec.describe WikiPage do container.wiki end - def disable_front_matter - stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => false) - end - - def enable_front_matter_for(thing) - stub_feature_flags(Gitlab::WikiPages::FrontMatterParser::FEATURE_FLAG => thing) - end - # Use for groups of tests that do not modify their `subject`. # # include_context 'subject is persisted page', title: 'my title' @@ -48,12 +40,6 @@ RSpec.describe WikiPage do it { expect(wiki_page).to have_attributes(front_matter: {}, content: content) } end - shared_examples 'a page with front-matter' do - let(:front_matter) { { title: 'Foo', slugs: %w[slug_a slug_b] } } - - it { expect(wiki_page.front_matter).to eq(front_matter) } - end - context 'the wiki page has front matter' do let(:content) do <<~MD @@ -68,27 +54,13 @@ RSpec.describe WikiPage do MD end - it_behaves_like 'a page with front-matter' + it 'has front-matter' do + expect(wiki_page.front_matter).to eq({ title: 'Foo', slugs: %w[slug_a slug_b] }) + end it 'strips the front matter from the content' do expect(wiki_page.content.strip).to eq('My actual content') end - - context 'the feature flag is off' do - before do - disable_front_matter - end - - it_behaves_like 'a page without front-matter' - - context 'but enabled for the container' do - before do - enable_front_matter_for(container) - end - - it_behaves_like 'a page with front-matter' - end - end end context 'the wiki page does not have front matter' do @@ -471,29 +443,6 @@ RSpec.describe WikiPage do end end - context 'the front-matter feature flag is not enabled' do - before do - disable_front_matter - end - - it 'does not update the front-matter' do - content = subject.content - subject.update(front_matter: { slugs: ['x'] }) - - page = wiki.find_page(subject.title) - - expect([subject, page]).to all(have_attributes(front_matter: be_empty, content: content)) - end - - context 'but it is enabled for the container' do - before do - enable_front_matter_for(container) - end - - it_behaves_like 'able to update front-matter' - end - end - it 'updates the wiki-page front-matter and content together' do content = 'totally new content' subject.update(content: content, front_matter: { slugs: ['x'] }) |