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/support/shared_examples/models')
-rw-r--r--spec/support/shared_examples/models/chat_integration_shared_examples.rb51
-rw-r--r--spec/support/shared_examples/models/cluster_application_core_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/models/concerns/analytics/cycle_analytics/stage_event_model_examples.rb2
-rw-r--r--spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb4
-rw-r--r--spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb6
-rw-r--r--spec/support/shared_examples/models/concerns/incident_management/escalatable_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/models/label_note_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/models/members_notifications_shared_example.rb4
-rw-r--r--spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb12
-rw-r--r--spec/support/shared_examples/models/project_latest_successful_build_for_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/models/synthetic_note_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/models/update_project_statistics_shared_examples.rb3
-rw-r--r--spec/support/shared_examples/models/wiki_shared_examples.rb162
13 files changed, 171 insertions, 83 deletions
diff --git a/spec/support/shared_examples/models/chat_integration_shared_examples.rb b/spec/support/shared_examples/models/chat_integration_shared_examples.rb
index fb08784f34f..6cfeeabc952 100644
--- a/spec/support/shared_examples/models/chat_integration_shared_examples.rb
+++ b/spec/support/shared_examples/models/chat_integration_shared_examples.rb
@@ -32,9 +32,11 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
describe "#execute" do
- let(:user) { create(:user) }
- let(:project) { create(:project, :repository) }
+ let_it_be(:user) { create(:user) }
+ let_it_be_with_reload(:project) { create(:project, :repository) }
+
let(:webhook_url) { "https://example.gitlab.com/" }
+ let(:webhook_url_regex) { /\A#{webhook_url}.*/ }
before do
allow(subject).to receive_messages(
@@ -44,7 +46,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
webhook: webhook_url
)
- WebMock.stub_request(:post, webhook_url)
+ WebMock.stub_request(:post, webhook_url_regex)
end
shared_examples "triggered #{integration_name} integration" do |branches_to_be_notified: nil|
@@ -56,7 +58,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
result = subject.execute(sample_data)
expect(result).to be(true)
- expect(WebMock).to have_requested(:post, webhook_url).once.with { |req|
+ expect(WebMock).to have_requested(:post, webhook_url_regex).once.with { |req|
json_body = Gitlab::Json.parse(req.body).with_indifferent_access
expect(json_body).to include(payload)
}
@@ -72,7 +74,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
result = subject.execute(sample_data)
expect(result).to be_falsy
- expect(WebMock).not_to have_requested(:post, webhook_url)
+ expect(WebMock).not_to have_requested(:post, webhook_url_regex)
end
end
@@ -112,14 +114,14 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context "with protected branch" do
- before do
- create(:protected_branch, :create_branch_on_repository, project: project, name: "a-protected-branch")
- end
-
let(:sample_data) do
Gitlab::DataBuilder::Push.build(project: project, user: user, ref: "a-protected-branch")
end
+ before_all do
+ create(:protected_branch, :create_branch_on_repository, project: project, name: "a-protected-branch")
+ end
+
context "when only default branch are to be notified" do
it_behaves_like "untriggered #{integration_name} integration", branches_to_be_notified: "default"
end
@@ -214,7 +216,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
let(:sample_data) { Gitlab::DataBuilder::Note.build(note, user) }
context "with commit comment" do
- let(:note) do
+ let_it_be(:note) do
create(:note_on_commit,
author: user,
project: project,
@@ -226,7 +228,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context "with merge request comment" do
- let(:note) do
+ let_it_be(:note) do
create(:note_on_merge_request, project: project, note: "merge request note")
end
@@ -234,7 +236,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context "with issue comment" do
- let(:note) do
+ let_it_be(:note) do
create(:note_on_issue, project: project, note: "issue note")
end
@@ -242,7 +244,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context "with snippet comment" do
- let(:note) do
+ let_it_be(:note) do
create(:note_on_project_snippet, project: project, note: "snippet note")
end
@@ -251,22 +253,24 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context "with pipeline events" do
- let(:pipeline) do
- create(:ci_pipeline,
- project: project, status: status,
- sha: project.commit.sha, ref: project.default_branch)
- end
-
let(:sample_data) { Gitlab::DataBuilder::Pipeline.build(pipeline) }
context "with failed pipeline" do
- let(:status) { "failed" }
+ let_it_be(:pipeline) do
+ create(:ci_pipeline,
+ project: project, status: "failed",
+ sha: project.commit.sha, ref: project.default_branch)
+ end
it_behaves_like "triggered #{integration_name} integration"
end
context "with succeeded pipeline" do
- let(:status) { "success" }
+ let_it_be(:pipeline) do
+ create(:ci_pipeline,
+ project: project, status: "success",
+ sha: project.commit.sha, ref: project.default_branch)
+ end
context "with default notify_only_broken_pipelines" do
it "does not call #{integration_name} API" do
@@ -308,7 +312,7 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context "with protected branch" do
- before do
+ before_all do
create(:protected_branch, :create_branch_on_repository, project: project, name: "a-protected-branch")
end
@@ -357,7 +361,8 @@ RSpec.shared_examples "chat integration" do |integration_name|
end
context 'deployment events' do
- let(:deployment) { create(:deployment) }
+ let_it_be(:deployment) { create(:deployment) }
+
let(:sample_data) { Gitlab::DataBuilder::Deployment.build(deployment, deployment.status, Time.now) }
it_behaves_like "untriggered #{integration_name} integration"
diff --git a/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb
index 51071ae47c3..ca9122bf61f 100644
--- a/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb
+++ b/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb
@@ -37,7 +37,7 @@ RSpec.shared_examples 'cluster application core specs' do |application_name|
with_them do
subject { described_class.new(cluster: cluster).helm_command_module }
- let(:cluster) { build(:cluster, helm_major_version: helm_major_version)}
+ let(:cluster) { build(:cluster, helm_major_version: helm_major_version) }
it { is_expected.to eq(expected_helm_command_module) }
end
diff --git a/spec/support/shared_examples/models/concerns/analytics/cycle_analytics/stage_event_model_examples.rb b/spec/support/shared_examples/models/concerns/analytics/cycle_analytics/stage_event_model_examples.rb
index 8ff30021d6e..6f104f400bc 100644
--- a/spec/support/shared_examples/models/concerns/analytics/cycle_analytics/stage_event_model_examples.rb
+++ b/spec/support/shared_examples/models/concerns/analytics/cycle_analytics/stage_event_model_examples.rb
@@ -89,7 +89,7 @@ RSpec.shared_examples 'StageEventModel' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:user) }
let_it_be(:milestone) { create(:milestone) }
- let_it_be(:issuable_with_assignee) { create(issuable_factory, assignees: [user])}
+ let_it_be(:issuable_with_assignee) { create(issuable_factory, assignees: [user]) }
let_it_be(:record) { create(stage_event_factory, start_event_timestamp: 3.years.ago.to_date, end_event_timestamp: 2.years.ago.to_date) }
let_it_be(:record_with_author) { create(stage_event_factory, author_id: user.id) }
diff --git a/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb b/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb
index f4d5ab3d5c6..f3a12578912 100644
--- a/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/counter_attribute_shared_examples.rb
@@ -75,9 +75,9 @@ RSpec.shared_examples_for CounterAttribute do |counter_attributes|
end
context 'when attribute is not a counter attribute' do
- it 'delegates to ActiveRecord update!' do
+ it 'raises ArgumentError' do
expect { model.delayed_increment_counter(:unknown_attribute, 10) }
- .to raise_error(ActiveModel::MissingAttributeError)
+ .to raise_error(ArgumentError, 'unknown_attribute is not a counter attribute')
end
end
end
diff --git a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
index a403a27adef..0a07c9d677b 100644
--- a/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/has_repository_shared_examples.rb
@@ -125,17 +125,17 @@ RSpec.shared_examples 'model with repository' do
end
describe '#valid_repo?' do
- it { expect(stubbed_container.valid_repo?).to be(false)}
+ it { expect(stubbed_container.valid_repo?).to be(false) }
it { expect(container.valid_repo?).to be(true) }
end
describe '#repository_exists?' do
- it { expect(stubbed_container.repository_exists?).to be(false)}
+ it { expect(stubbed_container.repository_exists?).to be(false) }
it { expect(container.repository_exists?).to be(true) }
end
describe '#repo_exists?' do
- it { expect(stubbed_container.repo_exists?).to be(false)}
+ it { expect(stubbed_container.repo_exists?).to be(false) }
it { expect(container.repo_exists?).to be(true) }
end
diff --git a/spec/support/shared_examples/models/concerns/incident_management/escalatable_shared_examples.rb b/spec/support/shared_examples/models/concerns/incident_management/escalatable_shared_examples.rb
index 8ee76efc896..a5970f134d9 100644
--- a/spec/support/shared_examples/models/concerns/incident_management/escalatable_shared_examples.rb
+++ b/spec/support/shared_examples/models/concerns/incident_management/escalatable_shared_examples.rb
@@ -77,7 +77,7 @@ RSpec.shared_examples 'a model including Escalatable' do
end
context 'scopes' do
- let(:all_escalatables) { described_class.where(id: [triggered_escalatable, acknowledged_escalatable, ignored_escalatable, resolved_escalatable])}
+ let(:all_escalatables) { described_class.where(id: [triggered_escalatable, acknowledged_escalatable, ignored_escalatable, resolved_escalatable]) }
describe '.order_status' do
subject { all_escalatables.order_status(order) }
diff --git a/spec/support/shared_examples/models/label_note_shared_examples.rb b/spec/support/shared_examples/models/label_note_shared_examples.rb
index 73066fb631a..f61007f57fd 100644
--- a/spec/support/shared_examples/models/label_note_shared_examples.rb
+++ b/spec/support/shared_examples/models/label_note_shared_examples.rb
@@ -12,7 +12,7 @@ RSpec.shared_examples 'label note created from events' do
def label_refs(events)
labels = events.map(&:label).compact
- labels.map { |l| l.to_reference}.sort.join(' ')
+ labels.map { |l| l.to_reference }.sort.join(' ')
end
let(:time) { Time.now }
diff --git a/spec/support/shared_examples/models/members_notifications_shared_example.rb b/spec/support/shared_examples/models/members_notifications_shared_example.rb
index 75eed0203a7..e74aab95e46 100644
--- a/spec/support/shared_examples/models/members_notifications_shared_example.rb
+++ b/spec/support/shared_examples/models/members_notifications_shared_example.rb
@@ -8,7 +8,7 @@ RSpec.shared_examples 'members notifications' do |entity_type|
end
describe "#after_create" do
- let(:member) { build(:"#{entity_type}_member") }
+ let(:member) { build(:"#{entity_type}_member", "#{entity_type}": create(entity_type.to_s)) }
it "sends email to user" do
expect(notification_service).to receive(:"new_#{entity_type}_member").with(member)
@@ -35,7 +35,7 @@ RSpec.shared_examples 'members notifications' do |entity_type|
describe '#after_commit' do
context 'on creation of a member requesting access' do
- let(:member) { build(:"#{entity_type}_member", :access_request) }
+ let(:member) { build(:"#{entity_type}_member", :access_request, "#{entity_type}": create(entity_type.to_s)) }
it "calls NotificationService.new_access_request" do
expect(notification_service).to receive(:new_access_request).with(member)
diff --git a/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb b/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb
index 6b0ae589efb..3d7d97bbeae 100644
--- a/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb
+++ b/spec/support/shared_examples/models/packages/debian/distribution_shared_examples.rb
@@ -202,17 +202,17 @@ RSpec.shared_examples 'Debian Distribution' do |factory, container, can_freeze|
end
else
describe 'group distribution specifics' do
- let_it_be(:public_project) { create(:project, :public, group: distribution_with_suite.container)}
+ let_it_be(:public_project) { create(:project, :public, group: distribution_with_suite.container) }
let_it_be(:public_distribution_with_same_codename) { create(:debian_project_distribution, container: public_project, codename: distribution_with_suite.codename) }
- let_it_be(:public_package_with_same_codename) { create(:debian_package, project: public_project, published_in: public_distribution_with_same_codename)}
+ let_it_be(:public_package_with_same_codename) { create(:debian_package, project: public_project, published_in: public_distribution_with_same_codename) }
let_it_be(:public_distribution_with_same_suite) { create(:debian_project_distribution, container: public_project, suite: distribution_with_suite.suite) }
- let_it_be(:public_package_with_same_suite) { create(:debian_package, project: public_project, published_in: public_distribution_with_same_suite)}
+ let_it_be(:public_package_with_same_suite) { create(:debian_package, project: public_project, published_in: public_distribution_with_same_suite) }
- let_it_be(:private_project) { create(:project, :private, group: distribution_with_suite.container)}
+ let_it_be(:private_project) { create(:project, :private, group: distribution_with_suite.container) }
let_it_be(:private_distribution_with_same_codename) { create(:debian_project_distribution, container: private_project, codename: distribution_with_suite.codename) }
- let_it_be(:private_package_with_same_codename) { create(:debian_package, project: private_project, published_in: private_distribution_with_same_codename)}
+ let_it_be(:private_package_with_same_codename) { create(:debian_package, project: private_project, published_in: private_distribution_with_same_codename) }
let_it_be(:private_distribution_with_same_suite) { create(:debian_project_distribution, container: private_project, suite: distribution_with_suite.suite) }
- let_it_be(:private_package_with_same_suite) { create(:debian_package, project: private_project, published_in: private_distribution_with_same_codename)}
+ let_it_be(:private_package_with_same_suite) { create(:debian_package, project: private_project, published_in: private_distribution_with_same_codename) }
describe '#packages' do
subject { distribution_with_suite.packages }
diff --git a/spec/support/shared_examples/models/project_latest_successful_build_for_shared_examples.rb b/spec/support/shared_examples/models/project_latest_successful_build_for_shared_examples.rb
index 66cd8d1df12..9093b386a5d 100644
--- a/spec/support/shared_examples/models/project_latest_successful_build_for_shared_examples.rb
+++ b/spec/support/shared_examples/models/project_latest_successful_build_for_shared_examples.rb
@@ -64,7 +64,7 @@ RSpec.shared_examples 'latest successful build for sha or ref' do
context 'with build belonging to a child pipeline' do
let(:child_pipeline) { create_pipeline(project) }
let(:parent_bridge) { create(:ci_bridge, pipeline: pipeline, project: pipeline.project) }
- let!(:pipeline_source) { create(:ci_sources_pipeline, source_job: parent_bridge, pipeline: child_pipeline)}
+ let!(:pipeline_source) { create(:ci_sources_pipeline, source_job: parent_bridge, pipeline: child_pipeline) }
let!(:child_build) { create_build(child_pipeline, 'child-build') }
let(:build_name) { child_build.name }
diff --git a/spec/support/shared_examples/models/synthetic_note_shared_examples.rb b/spec/support/shared_examples/models/synthetic_note_shared_examples.rb
index a41ade2950a..12e865b1312 100644
--- a/spec/support/shared_examples/models/synthetic_note_shared_examples.rb
+++ b/spec/support/shared_examples/models/synthetic_note_shared_examples.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.shared_examples 'a synthetic note' do |action|
- it_behaves_like 'a system note', exclude_project: true do
+ it_behaves_like 'a system note', exclude_project: true, skip_persistence_check: true do
let(:action) { action }
end
diff --git a/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb b/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
index ad0bbc0aeff..b81bd514d0a 100644
--- a/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
+++ b/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb
@@ -26,9 +26,6 @@ RSpec.shared_examples 'UpdateProjectStatistics' do |with_counter_attribute|
expect(FlushCounterIncrementsWorker)
.to receive(:perform_in)
.with(CounterAttribute::WORKER_DELAY, project.statistics.class.name, project.statistics.id, project_statistics_name)
- expect(FlushCounterIncrementsWorker)
- .to receive(:perform_in)
- .with(CounterAttribute::WORKER_DELAY, project.statistics.class.name, project.statistics.id, :storage_size)
yield
diff --git a/spec/support/shared_examples/models/wiki_shared_examples.rb b/spec/support/shared_examples/models/wiki_shared_examples.rb
index 604c57768fe..5f6a10bd754 100644
--- a/spec/support/shared_examples/models/wiki_shared_examples.rb
+++ b/spec/support/shared_examples/models/wiki_shared_examples.rb
@@ -286,67 +286,134 @@ RSpec.shared_examples 'wiki model' do
end
describe '#find_page' do
- before do
- subject.create_page('index page', 'This is an awesome Gollum Wiki')
- end
+ shared_examples 'wiki model #find_page' do
+ before do
+ subject.create_page('index page', 'This is an awesome Gollum Wiki')
+ end
- it 'returns the latest version of the page if it exists' do
- page = subject.find_page('index page')
+ it 'returns the latest version of the page if it exists' do
+ page = subject.find_page('index page')
- expect(page.title).to eq('index page')
- end
+ expect(page.title).to eq('index page')
+ end
- it 'returns nil if the page or version does not exist' do
- expect(subject.find_page('non-existent')).to be_nil
- expect(subject.find_page('index page', 'non-existent')).to be_nil
- end
+ it 'returns nil if the page or version does not exist' do
+ expect(subject.find_page('non-existent')).to be_nil
+ expect(subject.find_page('index page', 'non-existent')).to be_nil
+ end
- it 'can find a page by slug' do
- page = subject.find_page('index-page')
+ it 'can find a page by slug' do
+ page = subject.find_page('index-page')
- expect(page.title).to eq('index page')
- end
+ expect(page.title).to eq('index page')
+ end
- it 'returns a WikiPage instance' do
- page = subject.find_page('index page')
+ it 'returns a WikiPage instance' do
+ page = subject.find_page('index page')
- expect(page).to be_a WikiPage
- end
+ expect(page).to be_a WikiPage
+ end
- context 'pages with multibyte-character title' do
- before do
- subject.create_page('autre pagé', "C'est un génial Gollum Wiki")
+ context 'pages with multibyte-character title' do
+ before do
+ subject.create_page('autre pagé', "C'est un génial Gollum Wiki")
+ end
+
+ it 'can find a page by slug' do
+ page = subject.find_page('autre pagé')
+
+ expect(page.title).to eq('autre pagé')
+ end
end
- it 'can find a page by slug' do
- page = subject.find_page('autre pagé')
+ context 'pages with invalidly-encoded content' do
+ before do
+ subject.create_page('encoding is fun', "f\xFCr".b)
+ end
+
+ it 'can find the page' do
+ page = subject.find_page('encoding is fun')
+
+ expect(page.content).to eq('fr')
+ end
+ end
+
+ context 'pages with different file extensions' do
+ where(:extension, :path, :title) do
+ [
+ [:md, "wiki-markdown.md", "wiki markdown"],
+ [:markdown, "wiki-markdown-2.md", "wiki markdown 2"],
+ [:rdoc, "wiki-rdoc.rdoc", "wiki rdoc"],
+ [:asciidoc, "wiki-asciidoc.asciidoc", "wiki asciidoc"],
+ [:adoc, "wiki-asciidoc-2.adoc", "wiki asciidoc 2"],
+ [:org, "wiki-org.org", "wiki org"],
+ [:textile, "wiki-textile.textile", "wiki textile"],
+ [:creole, "wiki-creole.creole", "wiki creole"],
+ [:rest, "wiki-rest.rest", "wiki rest"],
+ [:rst, "wiki-rest-2.rst", "wiki rest 2"],
+ [:mediawiki, "wiki-mediawiki.mediawiki", "wiki mediawiki"],
+ [:wiki, "wiki-mediawiki-2.wiki", "wiki mediawiki 2"],
+ [:pod, "wiki-pod.pod", "wiki pod"],
+ [:text, "wiki-text.txt", "wiki text"]
+ ]
+ end
- expect(page.title).to eq('autre pagé')
+ with_them do
+ before do
+ wiki.repository.create_file(
+ user, path, "content of wiki file",
+ branch_name: wiki.default_branch,
+ message: "created page #{path}",
+ author_email: user.email,
+ author_name: user.name
+ )
+ end
+
+ it "can find page with #{params[:extension]} extension" do
+ page = subject.find_page(title)
+
+ expect(page.content).to eq("content of wiki file")
+ end
+ end
end
end
- context 'pages with invalidly-encoded content' do
+ context 'find page with legacy wiki service' do
before do
- subject.create_page('encoding is fun', "f\xFCr".b)
+ stub_feature_flags(wiki_find_page_with_normal_repository_rpcs: false)
end
- it 'can find the page' do
- page = subject.find_page('encoding is fun')
+ it_behaves_like 'wiki model #find_page'
+ end
- expect(page.content).to eq('fr')
- end
+ context 'find page with normal repository RPCs' do
+ it_behaves_like 'wiki model #find_page'
end
end
describe '#find_sidebar' do
- before do
- subject.create_page(described_class::SIDEBAR, 'This is an awesome Sidebar')
+ shared_examples 'wiki model #find_sidebar' do
+ before do
+ subject.create_page(described_class::SIDEBAR, 'This is an awesome Sidebar')
+ end
+
+ it 'finds the page defined as _sidebar' do
+ page = subject.find_sidebar
+
+ expect(page.content).to eq('This is an awesome Sidebar')
+ end
end
- it 'finds the page defined as _sidebar' do
- page = subject.find_sidebar
+ context 'find sidebar with legacy wiki service' do
+ before do
+ stub_feature_flags(wiki_find_page_with_normal_repository_rpcs: false)
+ end
- expect(page.content).to eq('This is an awesome Sidebar')
+ it_behaves_like 'wiki model #find_sidebar'
+ end
+
+ context 'find sidebar with normal repository RPCs' do
+ it_behaves_like 'wiki model #find_sidebar'
end
end
@@ -450,9 +517,7 @@ RSpec.shared_examples 'wiki model' do
expect(subject.error_message).to match(/Duplicate page:/)
end
- end
- it_behaves_like 'create_page tests' do
it 'returns false if a page exists already in the repository', :aggregate_failures do
subject.create_page('test page', 'content')
@@ -540,6 +605,16 @@ RSpec.shared_examples 'wiki model' do
end
end
end
+
+ it_behaves_like 'create_page tests'
+
+ context 'create page with legacy find_page wiki service' do
+ it_behaves_like 'create_page tests' do
+ before do
+ stub_feature_flags(wiki_find_page_with_normal_repository_rpcs: false)
+ end
+ end
+ end
end
describe '#update_page' do
@@ -636,6 +711,17 @@ RSpec.shared_examples 'wiki model' do
include_context 'extended examples'
end
+ context 'update page with legacy find_page wiki service' do
+ it_behaves_like 'update_page tests' do
+ before do
+ stub_feature_flags(wiki_find_page_with_normal_repository_rpcs: false)
+ end
+
+ include_context 'common examples'
+ include_context 'extended examples'
+ end
+ end
+
context 'when format is invalid' do
let!(:page) { create(:wiki_page, wiki: subject, title: 'test page') }