+
Here is another broadcast message
`);
diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js
index 7921c6953bf..6820d9ceab7 100644
--- a/spec/frontend/diffs/store/mutations_spec.js
+++ b/spec/frontend/diffs/store/mutations_spec.js
@@ -1322,6 +1322,7 @@ describe('DiffsStoreMutations', () => {
[INLINE_DIFF_LINES_KEY]: [
{ line_code: 'foo', discussions: [{}], discussionsExpanded: false },
],
+ discussions: [{ expandedOnDiff: false }],
},
{
[INLINE_DIFF_LINES_KEY]: [],
@@ -1333,6 +1334,7 @@ describe('DiffsStoreMutations', () => {
mutations[types.SET_EXPAND_ALL_DIFF_DISCUSSIONS](state, true);
expect(state.diffFiles[0][INLINE_DIFF_LINES_KEY][0].discussionsExpanded).toBe(true);
+ expect(state.diffFiles[0].discussions[0].expandedOnDiff).toBe(true);
expect(state.diffFiles[1].discussions[0].expandedOnDiff).toBe(true);
});
});
diff --git a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
index 629416ed070..5bb52da5bbb 100644
--- a/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
+++ b/spec/frontend/pages/shared/wikis/components/wiki_form_spec.js
@@ -36,7 +36,7 @@ describe('WikiForm', () => {
const findMarkdownEditor = () => wrapper.findComponent(MarkdownEditor);
const findSubmitButton = () => wrapper.findByTestId('wiki-submit-button');
const findCancelButton = () => wrapper.findByTestId('wiki-cancel-button');
- const findTitleHelpLink = () => wrapper.findByText('Learn more.');
+
const findMarkdownHelpLink = () => wrapper.findByTestId('wiki-markdown-help-link');
const findTemplatesDropdown = () => wrapper.findComponent(WikiTemplate);
@@ -67,6 +67,7 @@ describe('WikiForm', () => {
const pageInfoPersisted = {
...pageInfoNew,
persisted: true,
+ slug: 'My-page',
title: 'My page',
content: ' My page content ',
format: 'markdown',
@@ -327,20 +328,6 @@ describe('WikiForm', () => {
expect(wrapper.text()).toContain(text);
});
- it.each`
- persisted | titleHelpText | titleHelpLink
- ${true} | ${'You can move this page by adding the path to the beginning of the title.'} | ${'/help/user/project/wiki/index#move-a-wiki-page'}
- ${false} | ${'You can specify the full path for the new file. We will automatically create any missing directories.'} | ${'/help/user/project/wiki/index#create-a-new-wiki-page'}
- `(
- 'shows appropriate title help text and help link for when persisted=$persisted',
- ({ persisted, titleHelpLink, titleHelpText }) => {
- createWrapper({ persisted });
-
- expect(wrapper.text()).toContain(titleHelpText);
- expect(findTitleHelpLink().attributes().href).toBe(titleHelpLink);
- },
- );
-
it('shows correct link for wiki specific markdown docs', () => {
createWrapper({ mountFn: mount });
@@ -366,7 +353,7 @@ describe('WikiForm', () => {
['authenticity_token', ''],
['_method', 'put'],
['wiki[last_commit_sha]', ''],
- ['wiki[title]', 'My page'],
+ ['wiki[title]', 'My-page'],
['wiki[format]', 'markdown'],
['wiki[content]', ' Lorem ipsum dolar sit! '],
['wiki[message]', 'Update My page'],
@@ -506,12 +493,11 @@ describe('WikiForm', () => {
});
});
- describe('when wiki_front_matter_title feature flag is enabled', () => {
+ describe('path field', () => {
beforeEach(() => {
createWrapper({
mountFn: mount,
pageInfo: pageInfoWithFrontmatter(),
- provide: { glFeatures: { wikiFrontMatterTitle: true } },
});
});
@@ -571,32 +557,4 @@ describe('WikiForm', () => {
});
});
});
-
- describe('when wiki_front_matter_title feature flag is disabled', () => {
- beforeEach(() => {
- createWrapper({
- mountFn: mount,
- pageInfo: pageInfoWithFrontmatter(),
- provide: { glFeatures: { wikiFrontMatterTitle: false } },
- });
- });
-
- it('does not show the path field', () => {
- expect(findPath().exists()).toBe(false);
- });
-
- it("retains page's frontmatter on form submit", async () => {
- await findForm().trigger('submit');
-
- expect([...getFormData().entries()]).toEqual([
- ['authenticity_token', ''],
- ['_method', 'put'],
- ['wiki[last_commit_sha]', 'abcdef123'],
- ['wiki[title]', 'bar'],
- ['wiki[format]', 'markdown'],
- ['wiki[content]', '---\nfoo: bar\ntitle: real page title\n---\nfoo bar'],
- ['wiki[message]', 'Update bar'],
- ]);
- });
- });
});
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 3d165f7d830..5f64fc1899a 100644
--- a/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
+++ b/spec/lib/gitlab/wiki_pages/front_matter_parser_spec.rb
@@ -3,11 +3,10 @@
require 'spec_helper'
RSpec.describe Gitlab::WikiPages::FrontMatterParser do
- subject(:parser) { described_class.new(raw_content, gate) }
+ subject(:parser) { described_class.new(raw_content) }
let(:content) { 'This is the content' }
let(:end_divider) { '---' }
- let(:gate) { stub_feature_flag_gate('Gate') }
let(:with_front_matter) do
<<~MD
@@ -62,23 +61,9 @@ RSpec.describe Gitlab::WikiPages::FrontMatterParser do
it { is_expected.to have_attributes(reason: :no_match) }
end
- context 'the feature flag is disabled' do
+ context 'default' 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,
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 0ebdaa63f40..6769945084e 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -33,14 +33,6 @@ RSpec.describe WikiPage, feature_category: :wiki do
build(:wiki_page, wiki_page_attrs)
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
-
def force_wiki_change_branch
old_default_branch = wiki.default_branch
wiki.repository.add_branch(user, 'another_branch', old_default_branch)
@@ -92,22 +84,6 @@ RSpec.describe WikiPage, feature_category: :wiki do
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
@@ -526,29 +502,6 @@ RSpec.describe WikiPage, feature_category: :wiki 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'] })
@@ -1112,20 +1065,8 @@ RSpec.describe WikiPage, feature_category: :wiki do
let(:content_with_front_matter_title) { "---\ntitle: #{front_matter_title}\n---\nHome Page" }
let(:wiki_page) { create(:wiki_page, container: container, content: content_with_front_matter_title) }
- context "when wiki_front_matter_title enabled" do
- it 'returns the front matter title' do
- expect(wiki_page.human_title).to eq front_matter_title
- end
- end
-
- context "when wiki_front_matter_title disabled" do
- before do
- stub_feature_flags(wiki_front_matter_title: false)
- end
-
- it 'returns the page title' do
- expect(wiki_page.human_title).to eq wiki_page.title
- end
+ it 'returns the front matter title' do
+ expect(wiki_page.human_title).to eq front_matter_title
end
end
end
diff --git a/spec/support/shared_contexts/prometheus/alert_shared_context.rb b/spec/support/shared_contexts/prometheus/alert_shared_context.rb
index 13e739680c8..f78bfd149bd 100644
--- a/spec/support/shared_contexts/prometheus/alert_shared_context.rb
+++ b/spec/support/shared_contexts/prometheus/alert_shared_context.rb
@@ -38,28 +38,3 @@ RSpec.shared_context 'self-managed prometheus alert attributes' do
}
end
end
-
-RSpec.shared_context 'gitlab-managed prometheus alert attributes' do
- let_it_be(:prometheus_alert) { create(:prometheus_alert, project: project) }
- let(:prometheus_metric_id) { prometheus_alert.prometheus_metric_id }
-
- let(:payload) do
- {
- 'startsAt' => '2018-03-12T09:06:00Z',
- 'labels' => {
- 'gitlab_alert_id' => prometheus_metric_id
- }
- }
- end
-
- let(:dashboard_url_for_alert) do
- Gitlab::Routing.url_helpers.metrics_dashboard_project_prometheus_alert_url(
- project,
- prometheus_metric_id,
- environment_id: prometheus_alert.environment_id,
- embedded: true,
- end: '2018-03-12T09:36:00Z',
- start: '2018-03-12T08:36:00Z'
- )
- end
-end
diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
index 2d25f62e7de..a0e7244f904 100644
--- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
+++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
@@ -79,35 +79,6 @@ RSpec.shared_examples 'User updates wiki page' do
expect(page).to have_content('My awesome wiki!')
end
- context 'when :wiki_front_matter feature flags are disabled' do
- before do
- stub_feature_flags(
- wiki_front_matter: false,
- wiki_front_matter_title: false
- )
-
- visit(wiki_path(wiki))
- click_on('Edit')
- end
-
- it 'updates entry in redirects.yml file on changing page title' do
- wiki.repository.update_file(
- user, '.gitlab/redirects.yml',
- "home2: home\nfoo: bar",
- message: 'Add redirect', branch_name: 'master'
- )
-
- fill_in(:wiki_title, with: 'home2')
- fill_in(:wiki_content, with: 'My awesome wiki!')
- click_button('Save changes')
-
- expect(page).to have_content('Home')
- expect(page).to have_content('My awesome wiki!')
-
- expect(wiki.repository.blob_at('master', '.gitlab/redirects.yml').data).to eq("---\nfoo: bar\nhome: home2\n")
- end
- end
-
it 'updates entry in redirects.yml file on changing page path' do
wiki.repository.update_file(
user, '.gitlab/redirects.yml',
@@ -239,65 +210,6 @@ RSpec.shared_examples 'User updates wiki page' do
visit wiki_page_path(wiki, wiki_page, action: :edit)
end
- context 'when wiki_front_matter feature flags are disabled' do
- before do
- stub_feature_flags(
- wiki_front_matter: false,
- wiki_front_matter_title: false
- )
-
- visit wiki_page_path(wiki, wiki_page, action: :edit)
- end
-
- it 'moves the page to the root folder on changing the title', :js do
- fill_in(:wiki_title, with: "/#{page_name}")
-
- click_button('Save changes')
-
- expect(page).to have_current_path(wiki_page_path(wiki, page_name), ignore_query: true)
- end
-
- it 'moves the page to other dir on changing the title', :js do
- new_page_dir = "foo1/bar1/#{page_name}"
-
- fill_in(:wiki_title, with: new_page_dir)
-
- click_button('Save changes')
-
- expect(page).to have_current_path(wiki_page_path(wiki, new_page_dir), ignore_query: true)
- end
-
- it 'can be moved to a different dir with a different name by changing the title', :js do
- new_page_dir = "foo1/bar1/new_page_name"
-
- fill_in(:wiki_title, with: new_page_dir)
-
- click_button('Save changes')
-
- expect(page).to have_current_path(wiki_page_path(wiki, new_page_dir), ignore_query: true)
- end
-
- it 'can be renamed and moved to the root folder by changing the title', :js do
- new_name = 'new_page_name'
-
- fill_in(:wiki_title, with: "/#{new_name}")
-
- click_button('Save changes')
-
- expect(page).to have_current_path(wiki_page_path(wiki, new_name), ignore_query: true)
- end
-
- it 'squishes the title before creating the page', :js do
- new_page_dir = " foo1 / bar1 / #{page_name} "
-
- fill_in(:wiki_title, with: new_page_dir)
-
- click_button('Save changes')
-
- expect(page).to have_current_path(wiki_page_path(wiki, "foo1/bar1/#{page_name}"), ignore_query: true)
- end
- end
-
it 'does not move the page to root folder on changing the title' do
fill_in(:wiki_title, with: "/#{page_name}")
@@ -386,24 +298,6 @@ RSpec.shared_examples 'User updates wiki page' do
visit wiki_page_path(wiki_page.wiki, wiki_page, action: :edit)
end
- context 'when wiki_front_matter feature flags are disabled' do
- before do
- stub_feature_flags(
- wiki_front_matter: false,
- wiki_front_matter_title: false
- )
-
- visit wiki_page_path(wiki_page.wiki, wiki_page, action: :edit)
- end
-
- it 'allows changing the title if the content does not change', :js do
- fill_in :wiki_title, with: 'new title'
- click_on 'Save changes'
-
- expect(page).to have_content('Wiki page was successfully updated.')
- end
- end
-
it 'allows changing the path if the content does not change', :js do
fill_in :wiki_path, with: 'new-path'
click_on 'Save changes'
diff --git a/spec/support/shared_examples/metrics/url_shared_examples.rb b/spec/support/shared_examples/metrics/url_shared_examples.rb
deleted file mode 100644
index 67742aecb87..00000000000
--- a/spec/support/shared_examples/metrics/url_shared_examples.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-RSpec.shared_examples 'regex which matches url when expected' do
- it { is_expected.to be_a Regexp }
-
- it 'matches a metrics dashboard link with named params' do
- expect(subject).to match url
-
- subject.match(url) do |m|
- expect(m.named_captures).to eq expected_params
- end
- end
-
- it 'does not match other gitlab urls that contain the term metrics' do
- url = Gitlab::Routing.url_helpers.active_common_namespace_project_prometheus_metrics_url('foo', 'bar', :json)
-
- expect(subject).not_to match url
- end
-
- it 'does not match other gitlab urls' do
- url = Gitlab.config.gitlab.url
-
- expect(subject).not_to match url
- end
-
- it 'does not match non-gitlab urls' do
- url = 'https://www.super_awesome_site.com/'
-
- expect(subject).not_to match url
- end
-end