summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/lib/gitlab/gitaly_client_shared_examples.rb10
-rw-r--r--spec/support/shared_examples/lib/gitlab/project_search_results_shared_examples.rb14
-rw-r--r--spec/support/shared_examples/lib/sentry/client_shared_examples.rb6
-rw-r--r--spec/support/shared_examples/models/chat_integration_shared_examples.rb28
-rw-r--r--spec/support/shared_examples/models/clusters/prometheus_client_shared.rb10
-rw-r--r--spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb10
-rw-r--r--spec/support/shared_examples/models/member_shared_examples.rb24
-rw-r--r--spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb60
-rw-r--r--spec/support/shared_examples/quick_actions/issuable/max_issuable_examples.rb20
-rw-r--r--spec/support/shared_examples/views/pipeline_status_changes_email.rb14
10 files changed, 105 insertions, 91 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/gitaly_client_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/gitaly_client_shared_examples.rb
index f26b9a4a7bd..d388abb16c6 100644
--- a/spec/support/shared_examples/lib/gitlab/gitaly_client_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/gitaly_client_shared_examples.rb
@@ -1,10 +1,12 @@
# frozen_string_literal: true
def raw_repo_without_container(repository)
- Gitlab::Git::Repository.new(repository.shard,
- "#{repository.disk_path}.git",
- repository.repo_type.identifier_for_container(repository.container),
- repository.container.full_path)
+ Gitlab::Git::Repository.new(
+ repository.shard,
+ "#{repository.disk_path}.git",
+ repository.repo_type.identifier_for_container(repository.container),
+ repository.container.full_path
+ )
end
RSpec.shared_examples 'Gitaly feature flag actors are inferred from repository' do
diff --git a/spec/support/shared_examples/lib/gitlab/project_search_results_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/project_search_results_shared_examples.rb
index f83fecee4ea..0016f1e670d 100644
--- a/spec/support/shared_examples/lib/gitlab/project_search_results_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/project_search_results_shared_examples.rb
@@ -38,8 +38,7 @@ RSpec.shared_examples 'access restricted confidential issues' do
let(:user) { author }
it 'lists project confidential issues' do
- expect(objects).to contain_exactly(issue,
- security_issue_1)
+ expect(objects).to contain_exactly(issue, security_issue_1)
expect(results.limited_issues_count).to eq 2
end
end
@@ -48,8 +47,7 @@ RSpec.shared_examples 'access restricted confidential issues' do
let(:user) { assignee }
it 'lists project confidential issues for assignee' do
- expect(objects).to contain_exactly(issue,
- security_issue_2)
+ expect(objects).to contain_exactly(issue, security_issue_2)
expect(results.limited_issues_count).to eq 2
end
end
@@ -60,9 +58,7 @@ RSpec.shared_examples 'access restricted confidential issues' do
end
it 'lists project confidential issues' do
- expect(objects).to contain_exactly(issue,
- security_issue_1,
- security_issue_2)
+ expect(objects).to contain_exactly(issue, security_issue_1, security_issue_2)
expect(results.limited_issues_count).to eq 3
end
end
@@ -72,9 +68,7 @@ RSpec.shared_examples 'access restricted confidential issues' do
context 'when admin mode is enabled', :enable_admin_mode do
it 'lists all project issues' do
- expect(objects).to contain_exactly(issue,
- security_issue_1,
- security_issue_2)
+ expect(objects).to contain_exactly(issue, security_issue_1, security_issue_2)
end
end
diff --git a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb
index e0b411e1e2a..fa3e9bf5340 100644
--- a/spec/support/shared_examples/lib/sentry/client_shared_examples.rb
+++ b/spec/support/shared_examples/lib/sentry/client_shared_examples.rb
@@ -90,7 +90,9 @@ RSpec.shared_examples 'Sentry API response size limit' do
end
it 'raises an exception when response is too large' do
- expect { subject }.to raise_error(ErrorTracking::SentryClient::ResponseInvalidSizeError,
- 'Sentry API response is too big. Limit is 1 MB.')
+ expect { subject }.to raise_error(
+ ErrorTracking::SentryClient::ResponseInvalidSizeError,
+ 'Sentry API response is too big. Limit is 1 MB.'
+ )
end
end
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 085fec6ff1e..addd37cde32 100644
--- a/spec/support/shared_examples/models/chat_integration_shared_examples.rb
+++ b/spec/support/shared_examples/models/chat_integration_shared_examples.rb
@@ -221,11 +221,13 @@ RSpec.shared_examples "chat integration" do |integration_name|
context "with commit comment" do
let_it_be(:note) do
- create(:note_on_commit,
- author: user,
- project: project,
- commit_id: project.repository.commit.id,
- note: "a comment on a commit")
+ create(
+ :note_on_commit,
+ author: user,
+ project: project,
+ commit_id: project.repository.commit.id,
+ note: "a comment on a commit"
+ )
end
it_behaves_like "triggered #{integration_name} integration"
@@ -261,9 +263,11 @@ RSpec.shared_examples "chat integration" do |integration_name|
context "with failed pipeline" do
let_it_be(:pipeline) do
- create(:ci_pipeline,
- project: project, status: "failed",
- sha: project.commit.sha, ref: project.default_branch)
+ create(
+ :ci_pipeline,
+ project: project, status: "failed",
+ sha: project.commit.sha, ref: project.default_branch
+ )
end
it_behaves_like "triggered #{integration_name} integration"
@@ -271,9 +275,11 @@ RSpec.shared_examples "chat integration" do |integration_name|
context "with succeeded pipeline" do
let_it_be(:pipeline) do
- create(:ci_pipeline,
- project: project, status: "success",
- sha: project.commit.sha, ref: project.default_branch)
+ create(
+ :ci_pipeline,
+ project: project, status: "success",
+ sha: project.commit.sha, ref: project.default_branch
+ )
end
context "with default notify_only_broken_pipelines" do
diff --git a/spec/support/shared_examples/models/clusters/prometheus_client_shared.rb b/spec/support/shared_examples/models/clusters/prometheus_client_shared.rb
index 8d6dcfef925..140968da272 100644
--- a/spec/support/shared_examples/models/clusters/prometheus_client_shared.rb
+++ b/spec/support/shared_examples/models/clusters/prometheus_client_shared.rb
@@ -41,10 +41,12 @@ RSpec.shared_examples '#prometheus_client shared' do
subject.cluster.platform_kubernetes.namespace = 'a-namespace'
stub_kubeclient_discover(cluster.platform_kubernetes.api_url)
- create(:cluster_kubernetes_namespace,
- cluster: cluster,
- cluster_project: cluster.cluster_project,
- project: cluster.cluster_project.project)
+ create(
+ :cluster_kubernetes_namespace,
+ cluster: cluster,
+ cluster_project: cluster.cluster_project,
+ project: cluster.cluster_project.project
+ )
end
it 'creates proxy prometheus_client' do
diff --git a/spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb b/spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb
index 64390ccdc25..f1f6d799cf3 100644
--- a/spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb
+++ b/spec/support/shared_examples/models/diff_note_after_commit_shared_examples.rb
@@ -10,10 +10,12 @@ RSpec.shared_examples 'a valid diff note with after commit callback' do
it 'raises an error' do
allow(diff_file_from_repository).to receive(:line_for_position).with(position).and_return(nil)
- expect { subject.save! }.to raise_error(::DiffNote::NoteDiffFileCreationError,
- "Failed to find diff line for: #{diff_file_from_repository.file_path}, "\
- "old_line: #{position.old_line}"\
- ", new_line: #{position.new_line}")
+ expect { subject.save! }.to raise_error(
+ ::DiffNote::NoteDiffFileCreationError,
+ "Failed to find diff line for: #{diff_file_from_repository.file_path}, "\
+ "old_line: #{position.old_line}"\
+ ", new_line: #{position.new_line}"
+ )
end
end
diff --git a/spec/support/shared_examples/models/member_shared_examples.rb b/spec/support/shared_examples/models/member_shared_examples.rb
index 32b1cf24c0f..e9e25dee746 100644
--- a/spec/support/shared_examples/models/member_shared_examples.rb
+++ b/spec/support/shared_examples/models/member_shared_examples.rb
@@ -508,11 +508,13 @@ RSpec.shared_examples_for "bulk member creation" do
create(:member_task, member: member, project: task_project, tasks_to_be_done: %w(code ci))
expect do
- described_class.add_members(source,
- [user1.id],
- :developer,
- tasks_to_be_done: %w(issues),
- tasks_project_id: task_project.id)
+ described_class.add_members(
+ source,
+ [user1.id],
+ :developer,
+ tasks_to_be_done: %w(issues),
+ tasks_project_id: task_project.id
+ )
end.not_to change { MemberTask.count }
member.reset
@@ -522,11 +524,13 @@ RSpec.shared_examples_for "bulk member creation" do
it 'adds tasks to be done if they do not exist', :aggregate_failures do
expect do
- described_class.add_members(source,
- [user1.id],
- :developer,
- tasks_to_be_done: %w(issues),
- tasks_project_id: task_project.id)
+ described_class.add_members(
+ source,
+ [user1.id],
+ :developer,
+ tasks_to_be_done: %w(issues),
+ tasks_project_id: task_project.id
+ )
end.to change { MemberTask.count }.by(1)
member = source.members.find_by(user_id: user1.id)
diff --git a/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb b/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb
index f70621673d5..f9f8435c211 100644
--- a/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb
+++ b/spec/support/shared_examples/projects/container_repository/cleanup_tags_service_shared_examples.rb
@@ -7,9 +7,9 @@ RSpec.shared_examples 'when regex matching everything is specified' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
context 'with deprecated name_regex param' do
let(:params) do
@@ -17,9 +17,9 @@ RSpec.shared_examples 'when regex matching everything is specified' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
end
end
@@ -31,9 +31,9 @@ RSpec.shared_examples 'when regex matching everything is specified and latest is
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
end
RSpec.shared_examples 'when delete regex matching specific tags is used' do
@@ -43,9 +43,9 @@ RSpec.shared_examples 'when delete regex matching specific tags is used' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: [%w[C D]]
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: [%w[C D]]
end
RSpec.shared_examples 'when delete regex matching specific tags is used with overriding allow regex' do
@@ -58,9 +58,9 @@ RSpec.shared_examples 'when delete regex matching specific tags is used with ove
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: [%w[D]]
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: [%w[D]]
context 'with name_regex_delete overriding deprecated name_regex' do
let(:params) do
@@ -71,9 +71,9 @@ RSpec.shared_examples 'when delete regex matching specific tags is used with ove
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: [%w[D]]
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: [%w[D]]
end
end
@@ -87,9 +87,9 @@ RSpec.shared_examples 'with allow regex value' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
end
RSpec.shared_examples 'when keeping only N tags' do
@@ -135,9 +135,9 @@ RSpec.shared_examples 'when removing keeping only 3' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
end
RSpec.shared_examples 'when removing older than 1 day' do
@@ -150,9 +150,9 @@ RSpec.shared_examples 'when removing older than 1 day' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
end
RSpec.shared_examples 'when combining all parameters' do
@@ -166,9 +166,9 @@ RSpec.shared_examples 'when combining all parameters' do
end
it_behaves_like 'removing the expected tags',
- service_response_extra: service_response_extra,
- supports_caching: supports_caching,
- delete_expectations: delete_expectations
+ service_response_extra: service_response_extra,
+ supports_caching: supports_caching,
+ delete_expectations: delete_expectations
end
RSpec.shared_examples 'when running a container_expiration_policy' do
diff --git a/spec/support/shared_examples/quick_actions/issuable/max_issuable_examples.rb b/spec/support/shared_examples/quick_actions/issuable/max_issuable_examples.rb
index b5704ad8f17..9b03cdbb3bf 100644
--- a/spec/support/shared_examples/quick_actions/issuable/max_issuable_examples.rb
+++ b/spec/support/shared_examples/quick_actions/issuable/max_issuable_examples.rb
@@ -23,11 +23,11 @@ RSpec.shared_examples 'does not exceed the issuable size limit' do
end
note = described_class.new(project, user, opts.merge(
- note: note_text,
- noteable_type: noteable_type,
- noteable_id: issuable.id,
- confidential: false
- )).execute
+ note: note_text,
+ noteable_type: noteable_type,
+ noteable_id: issuable.id,
+ confidential: false
+ )).execute
expect(note.errors[:validation]).to match_array([validation_message])
end
@@ -44,11 +44,11 @@ RSpec.shared_examples 'does not exceed the issuable size limit' do
end
note = described_class.new(project, user, opts.merge(
- note: note_text,
- noteable_type: noteable_type,
- noteable_id: issuable.id,
- confidential: false
- )).execute
+ note: note_text,
+ noteable_type: noteable_type,
+ noteable_id: issuable.id,
+ confidential: false
+ )).execute
expect(note.errors[:validation]).to be_empty
end
diff --git a/spec/support/shared_examples/views/pipeline_status_changes_email.rb b/spec/support/shared_examples/views/pipeline_status_changes_email.rb
index 698f11c2216..fe6cc5e03d2 100644
--- a/spec/support/shared_examples/views/pipeline_status_changes_email.rb
+++ b/spec/support/shared_examples/views/pipeline_status_changes_email.rb
@@ -8,12 +8,14 @@ RSpec.shared_examples 'pipeline status changes email' do
let(:merge_request) { create(:merge_request, :simple, source_project: project) }
let(:pipeline) do
- create(:ci_pipeline,
- project: project,
- user: user,
- ref: project.default_branch,
- sha: project.commit.sha,
- status: status)
+ create(
+ :ci_pipeline,
+ project: project,
+ user: user,
+ ref: project.default_branch,
+ sha: project.commit.sha,
+ status: status
+ )
end
before do