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
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-09 18:09:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-09 18:09:07 +0300
commit07f3c9525c1df3ae1da995ea4fe6dd66bb61b9fd (patch)
treec44dcf94b5f26a02945720ffbd10364ad5bdbeb6 /spec
parent963e09aecfb3cdd57babdd9b37c15e34601fdb42 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/lib/utils/datetime/timeago_utility_spec.js19
-rw-r--r--spec/helpers/preferences_helper_spec.rb10
-rw-r--r--spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/issues_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/notes_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb10
-rw-r--r--spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb2
-rw-r--r--spec/lib/gitlab/github_import/parallel_scheduling_spec.rb12
-rw-r--r--spec/lib/gitlab/github_import/representation/to_hash_spec.rb12
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb3
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb2
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb2
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb2
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb3
-rw-r--r--spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb3
-rw-r--r--spec/models/ci/catalog/resource_spec.rb21
-rw-r--r--spec/models/project_spec.rb24
-rw-r--r--spec/models/upload_spec.rb4
-rw-r--r--spec/models/user_spec.rb3
-rw-r--r--spec/policies/project_policy_spec.rb82
-rw-r--r--spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb12
-rw-r--r--spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb18
-rw-r--r--spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb14
-rw-r--r--spec/requests/api/graphql/mutations/snippets/create_spec.rb6
-rw-r--r--spec/requests/api/graphql/mutations/snippets/destroy_spec.rb2
-rw-r--r--spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb2
-rw-r--r--spec/requests/api/graphql/mutations/snippets/update_spec.rb38
-rw-r--r--spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb14
-rw-r--r--spec/requests/api/graphql/mutations/todos/mark_done_spec.rb20
-rw-r--r--spec/requests/api/graphql/mutations/todos/restore_many_spec.rb20
-rw-r--r--spec/requests/api/graphql/mutations/todos/restore_spec.rb20
-rw-r--r--spec/services/web_hook_service_spec.rb36
-rw-r--r--spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb10
-rw-r--r--spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb4
-rw-r--r--spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb6
-rw-r--r--spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb4
-rw-r--r--spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb2
-rw-r--r--spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb4
49 files changed, 280 insertions, 194 deletions
diff --git a/spec/frontend/lib/utils/datetime/timeago_utility_spec.js b/spec/frontend/lib/utils/datetime/timeago_utility_spec.js
index 74ce8175357..44db4cf88a2 100644
--- a/spec/frontend/lib/utils/datetime/timeago_utility_spec.js
+++ b/spec/frontend/lib/utils/datetime/timeago_utility_spec.js
@@ -160,5 +160,24 @@ describe('TimeAgo utils', () => {
);
},
);
+
+ describe('With User Setting Time Format', () => {
+ it.each`
+ timeDisplayFormat | display | text
+ ${0} | ${'System'} | ${'Feb 18, 2020, 10:22 PM'}
+ ${1} | ${'12-hour'} | ${'Feb 18, 2020, 10:22 PM'}
+ ${2} | ${'24-hour'} | ${'Feb 18, 2020, 22:22'}
+ `(`'$display' renders as '$text'`, ({ timeDisplayFormat, text }) => {
+ gon.time_display_relative = false;
+ gon.time_display_format = timeDisplayFormat;
+
+ const element = document.querySelector('time');
+ localTimeAgo([element]);
+
+ jest.runAllTimers();
+
+ expect(element.innerText).toBe(text);
+ });
+ });
});
});
diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb
index 9d1564dfef1..0bd8792ae83 100644
--- a/spec/helpers/preferences_helper_spec.rb
+++ b/spec/helpers/preferences_helper_spec.rb
@@ -71,6 +71,16 @@ RSpec.describe PreferencesHelper do
end
end
+ describe '#time_display_format_choices_with_default' do
+ it 'returns choices' do
+ expect(helper.time_display_format_choices).to eq({
+ "12-hour: 2:34 PM" => 1,
+ "24-hour: 14:34" => 2,
+ "System" => 0
+ })
+ end
+ end
+
describe '#user_application_theme' do
context 'with a user' do
it "returns user's theme's css_class" do
diff --git a/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb b/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb
index dcb02f32a28..6f602531d23 100644
--- a/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe Gitlab::GithubImport::Importer::CollaboratorsImporter, feature_ca
it 'imports each collaborator in parallel' do
expect(Gitlab::GithubImport::ImportCollaboratorWorker).to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb
index 945b742b025..4e8066ecb69 100644
--- a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb
@@ -98,7 +98,7 @@ RSpec.describe Gitlab::GithubImport::Importer::DiffNotesImporter, feature_catego
.and_yield(github_comment)
expect(Gitlab::GithubImport::ImportDiffNoteWorker).to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb
index 04b694dc0cb..9aba6a2b02c 100644
--- a/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb
@@ -78,7 +78,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssueEventsImporter, feature_cate
allow(importer).to receive(:each_object_to_import).and_yield(issue_event)
expect(Gitlab::GithubImport::ImportIssueEventWorker).to receive(:perform_in).with(
- 1.second, project.id, an_instance_of(Hash), an_instance_of(String)
+ 1, project.id, an_instance_of(Hash), an_instance_of(String)
)
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
index d6fd1a4739c..1bfdce04187 100644
--- a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb
@@ -92,7 +92,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssuesImporter, feature_category:
expect(Gitlab::GithubImport::ImportIssueWorker)
.to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb b/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb
index fab9d26532d..3f5ee68d264 100644
--- a/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb
@@ -119,7 +119,7 @@ RSpec.describe Gitlab::GithubImport::Importer::LfsObjectsImporter, feature_categ
end
expect(Gitlab::GithubImport::ImportLfsObjectWorker).to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb
index 841cc8178ea..8c93963f325 100644
--- a/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb
@@ -84,7 +84,7 @@ RSpec.describe Gitlab::GithubImport::Importer::NotesImporter, feature_category:
.and_yield(github_comment)
expect(Gitlab::GithubImport::ImportNoteWorker).to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb b/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb
index 6a8b14a2690..8e99585109b 100644
--- a/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb
@@ -144,7 +144,7 @@ RSpec.describe Gitlab::GithubImport::Importer::ProtectedBranchesImporter, featur
it 'imports each protected branch in parallel' do
expect(Gitlab::GithubImport::ImportProtectedBranchWorker)
.to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
expect(Gitlab::GithubImport::ObjectCounter)
.to receive(:increment).with(project, :protected_branch, :fetched)
diff --git a/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb
index d0145ba1120..1977815e3a0 100644
--- a/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb
@@ -97,7 +97,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor
{ id: 4, login: 'alice' },
{ id: 5, login: 'bob' }
]
- },
+ }.deep_stringify_keys,
instance_of(String)
],
[
@@ -108,7 +108,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor
users: [
{ id: 4, login: 'alice' }
]
- },
+ }.deep_stringify_keys,
instance_of(String)
]
]
@@ -116,10 +116,10 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor
it 'schedule import for each merge request reviewers' do
expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker)
- .to receive(:perform_in).with(1.second, *expected_worker_payload.first)
+ .to receive(:perform_in).with(1, *expected_worker_payload.first)
expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker)
- .to receive(:perform_in).with(1.second, *expected_worker_payload.second)
+ .to receive(:perform_in).with(1, *expected_worker_payload.second)
expect(Gitlab::GithubImport::ObjectCounter)
.to receive(:increment).twice.with(project, :pull_request_review_request, :fetched)
@@ -137,7 +137,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor
it "doesn't schedule import this merge request reviewers" do
expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker)
- .to receive(:perform_in).with(1.second, *expected_worker_payload.second)
+ .to receive(:perform_in).with(1, *expected_worker_payload.second)
expect(Gitlab::GithubImport::ObjectCounter)
.to receive(:increment).once.with(project, :pull_request_review_request, :fetched)
diff --git a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
index cfd75fba849..10e413fdfe5 100644
--- a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb
@@ -102,7 +102,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter, feature_cat
expect(Gitlab::GithubImport::ImportPullRequestWorker)
.to receive(:perform_in)
- .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String))
+ .with(1, project.id, an_instance_of(Hash), an_instance_of(String))
waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb
index 9de39a3ff7e..e0b1ff1bc33 100644
--- a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb
+++ b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb
@@ -296,11 +296,11 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling, feature_category: :impo
expect(importer).to receive(:each_object_to_import)
.and_yield(object).and_yield(object).and_yield(object)
expect(worker_class).to receive(:perform_in)
- .with(1.second, project.id, { title: 'One' }, 'waiter-key').ordered
+ .with(1, project.id, { 'title' => 'One' }, 'waiter-key').ordered
expect(worker_class).to receive(:perform_in)
- .with(1.second, project.id, { title: 'Two' }, 'waiter-key').ordered
+ .with(1, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
expect(worker_class).to receive(:perform_in)
- .with(1.minute + 1.second, project.id, { title: 'Three' }, 'waiter-key').ordered
+ .with(61, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
job_waiter = importer.parallel_import
@@ -325,11 +325,11 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling, feature_category: :impo
expect(importer).to receive(:each_object_to_import).and_yield(object).and_yield(object).and_yield(object)
expect(worker_class).to receive(:perform_in)
- .with(1.second, project.id, { title: 'One' }, 'waiter-key').ordered
+ .with(1, project.id, { 'title' => 'One' }, 'waiter-key').ordered
expect(worker_class).to receive(:perform_in)
- .with(1.minute + 1.second, project.id, { title: 'Two' }, 'waiter-key').ordered
+ .with(61, project.id, { 'title' => 'Two' }, 'waiter-key').ordered
expect(worker_class).to receive(:perform_in)
- .with(2.minutes + 1.second, project.id, { title: 'Three' }, 'waiter-key').ordered
+ .with(121, project.id, { 'title' => 'Three' }, 'waiter-key').ordered
job_waiter = importer.parallel_import
diff --git a/spec/lib/gitlab/github_import/representation/to_hash_spec.rb b/spec/lib/gitlab/github_import/representation/to_hash_spec.rb
index 739c832025c..52edffe586d 100644
--- a/spec/lib/gitlab/github_import/representation/to_hash_spec.rb
+++ b/spec/lib/gitlab/github_import/representation/to_hash_spec.rb
@@ -2,14 +2,14 @@
require 'fast_spec_helper'
-RSpec.describe Gitlab::GithubImport::Representation::ToHash do
+RSpec.describe Gitlab::GithubImport::Representation::ToHash, feature_category: :importers do
describe '#to_hash' do
let(:user) { double(:user, attributes: { login: 'alice' }) }
let(:issue) do
double(
:issue,
- attributes: { user: user, assignees: [user], number: 42 }
+ attributes: { user: user, assignees: [user], number: 42, created_at: 5.days.ago, status: :valid }
)
end
@@ -35,5 +35,13 @@ RSpec.describe Gitlab::GithubImport::Representation::ToHash do
it 'keeps values as-is if they do not respond to #to_hash' do
expect(issue_hash[:number]).to eq(42)
end
+
+ it 'converts Date value to String' do
+ expect(issue_hash[:created_at]).to be_an_instance_of(String)
+ end
+
+ it 'converts Symbol value to String' do
+ expect(issue_hash[:status]).to be_an_instance_of(String)
+ end
end
end
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb
index 3e7b13e21c1..f6b9da68184 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::Usage::Metrics::Instrumentations::AggregatedMetric, :clean_gitlab_redis_shared_state do
+RSpec.describe Gitlab::Usage::Metrics::Instrumentations::AggregatedMetric, :clean_gitlab_redis_shared_state,
+ feature_category: :service_ping do
using RSpec::Parameterized::TableSyntax
before do
# weekly AND 1 weekly OR 2
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb
index 8ca42a6f007..9fcec56d019 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric do
+RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric, feature_category: :service_ping do
let(:database_metric_class) { Class.new(described_class) }
subject do
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb
index cc4df696b37..e65d5d30d9d 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Gitlab::Usage::Metrics::Instrumentations::GenericMetric do
+RSpec.describe Gitlab::Usage::Metrics::Instrumentations::GenericMetric, feature_category: :service_ping do
shared_examples 'custom fallback' do |custom_fallback|
subject do
Class.new(described_class) do
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb
index 180c76d56f3..008e30eca9c 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Gitlab::Usage::Metrics::Instrumentations::NumbersMetric do
+RSpec.describe Gitlab::Usage::Metrics::Instrumentations::NumbersMetric, feature_category: :service_ping do
subject do
described_class.tap do |metric_class|
metric_class.operation :add
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb
index 97306051533..33868d365a5 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric, :clean_gitlab_redis_shared_state do
+RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric, :clean_gitlab_redis_shared_state,
+ feature_category: :service_ping do
before do
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 1, time: 1.week.ago)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 1, time: 2.weeks.ago)
diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb
index c4d6edd43e1..90568f4731e 100644
--- a/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb
+++ b/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb
@@ -2,7 +2,8 @@
require 'spec_helper'
-RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisMetric, :clean_gitlab_redis_shared_state do
+RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisMetric, :clean_gitlab_redis_shared_state,
+ feature_category: :service_ping do
before do
4.times do
Gitlab::UsageDataCounters::SourceCodeCounter.count(:pushes)
diff --git a/spec/models/ci/catalog/resource_spec.rb b/spec/models/ci/catalog/resource_spec.rb
index 34268b92e1d..14c9d95bb11 100644
--- a/spec/models/ci/catalog/resource_spec.rb
+++ b/spec/models/ci/catalog/resource_spec.rb
@@ -174,15 +174,16 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do
end
describe 'sync with project' do
- shared_examples 'name and description of the catalog resource matches the project' do
+ shared_examples 'denormalized columns of the catalog resource match the project' do
it do
- expect(resource.reload.name).to eq(project.name)
- expect(resource.reload.description).to eq(project.description)
+ expect(resource.name).to eq(project.name)
+ expect(resource.description).to eq(project.description)
+ expect(resource.visibility_level).to eq(project.visibility_level)
end
end
context 'when the catalog resource is created' do
- it_behaves_like 'name and description of the catalog resource matches the project'
+ it_behaves_like 'denormalized columns of the catalog resource match the project'
end
context 'when the project name is updated' do
@@ -190,7 +191,7 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do
project.update!(name: 'My new project name')
end
- it_behaves_like 'name and description of the catalog resource matches the project'
+ it_behaves_like 'denormalized columns of the catalog resource match the project'
end
context 'when the project description is updated' do
@@ -198,7 +199,15 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do
project.update!(description: 'My new description')
end
- it_behaves_like 'name and description of the catalog resource matches the project'
+ it_behaves_like 'denormalized columns of the catalog resource match the project'
+ end
+
+ context 'when the project visibility_level is updated' do
+ before do
+ project.update!(visibility_level: 10)
+ end
+
+ it_behaves_like 'denormalized columns of the catalog resource match the project'
end
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index ce896af0799..096edb40511 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -9120,18 +9120,20 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
end
end
+ # TODO: Remove/update this spec after background syncing is implemented. See https://gitlab.com/gitlab-org/gitlab/-/issues/429376.
describe '#update_catalog_resource' do
let_it_be_with_reload(:project) { create(:project, name: 'My project name', description: 'My description') }
- let_it_be(:resource) { create(:ci_catalog_resource, project: project) }
+ let_it_be_with_reload(:resource) { create(:ci_catalog_resource, project: project) }
- shared_examples 'name and description of the catalog resource matches the project' do
+ shared_examples 'name, description, and visibility_level of the catalog resource match the project' do
it do
expect(project).to receive(:update_catalog_resource).once.and_call_original
project.save!
- expect(resource.reload.name).to eq(project.name)
- expect(resource.reload.description).to eq(project.description)
+ expect(resource.name).to eq(project.name)
+ expect(resource.description).to eq(project.description)
+ expect(resource.visibility_level).to eq(project.visibility_level)
end
end
@@ -9140,7 +9142,7 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
project.name = 'My new project name'
end
- it_behaves_like 'name and description of the catalog resource matches the project'
+ it_behaves_like 'name, description, and visibility_level of the catalog resource match the project'
end
context 'when the project description is updated' do
@@ -9148,10 +9150,18 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr
project.description = 'My new description'
end
- it_behaves_like 'name and description of the catalog resource matches the project'
+ it_behaves_like 'name, description, and visibility_level of the catalog resource match the project'
end
- context 'when neither the project name nor description are updated' do
+ context 'when the project visibility_level is updated' do
+ before do
+ project.visibility_level = 10
+ end
+
+ it_behaves_like 'name, description, and visibility_level of the catalog resource match the project'
+ end
+
+ context 'when neither the project name, description, nor visibility_level are updated' do
it 'does not call update_catalog_resource' do
expect(project).not_to receive(:update_catalog_resource)
diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rb
index 27e2060a94b..ff38edb73b6 100644
--- a/spec/models/upload_spec.rb
+++ b/spec/models/upload_spec.rb
@@ -266,7 +266,7 @@ RSpec.describe Upload do
it 'updates project statistics when upload is added' do
expect(ProjectCacheWorker).to receive(:perform_async)
- .with(project.id, [], [:uploads_size])
+ .with(project.id, [], ['uploads_size'])
subject.save!
end
@@ -275,7 +275,7 @@ RSpec.describe Upload do
subject.save!
expect(ProjectCacheWorker).to receive(:perform_async)
- .with(project.id, [], [:uploads_size])
+ .with(project.id, [], ['uploads_size'])
subject.destroy!
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 1c4b0fafc94..fd4b3dbb548 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -44,6 +44,9 @@ RSpec.describe User, feature_category: :user_profile do
it { is_expected.to delegate_method(:time_display_relative).to(:user_preference) }
it { is_expected.to delegate_method(:time_display_relative=).to(:user_preference).with_arguments(:args) }
+ it { is_expected.to delegate_method(:time_display_format).to(:user_preference) }
+ it { is_expected.to delegate_method(:time_display_format=).to(:user_preference).with_arguments(:args) }
+
it { is_expected.to delegate_method(:show_whitespace_in_diffs).to(:user_preference) }
it { is_expected.to delegate_method(:show_whitespace_in_diffs=).to(:user_preference).with_arguments(:args) }
diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb
index 7cd8879e114..fda889ff422 100644
--- a/spec/policies/project_policy_spec.rb
+++ b/spec/policies/project_policy_spec.rb
@@ -2395,44 +2395,48 @@ RSpec.describe ProjectPolicy, feature_category: :system_access do
developer_permissions + [:create_cluster, :read_cluster, :update_cluster, :admin_cluster, :admin_terraform_state, :admin_project_google_cloud]
end
- where(:project_visibility, :access_level, :role, :allowed) do
- :public | ProjectFeature::ENABLED | :maintainer | true
- :public | ProjectFeature::ENABLED | :developer | true
- :public | ProjectFeature::ENABLED | :guest | true
- :public | ProjectFeature::ENABLED | :anonymous | true
- :public | ProjectFeature::PRIVATE | :maintainer | true
- :public | ProjectFeature::PRIVATE | :developer | true
- :public | ProjectFeature::PRIVATE | :guest | true
- :public | ProjectFeature::PRIVATE | :anonymous | false
- :public | ProjectFeature::DISABLED | :maintainer | false
- :public | ProjectFeature::DISABLED | :developer | false
- :public | ProjectFeature::DISABLED | :guest | false
- :public | ProjectFeature::DISABLED | :anonymous | false
- :internal | ProjectFeature::ENABLED | :maintainer | true
- :internal | ProjectFeature::ENABLED | :developer | true
- :internal | ProjectFeature::ENABLED | :guest | true
- :internal | ProjectFeature::ENABLED | :anonymous | false
- :internal | ProjectFeature::PRIVATE | :maintainer | true
- :internal | ProjectFeature::PRIVATE | :developer | true
- :internal | ProjectFeature::PRIVATE | :guest | true
- :internal | ProjectFeature::PRIVATE | :anonymous | false
- :internal | ProjectFeature::DISABLED | :maintainer | false
- :internal | ProjectFeature::DISABLED | :developer | false
- :internal | ProjectFeature::DISABLED | :guest | false
- :internal | ProjectFeature::DISABLED | :anonymous | false
- :private | ProjectFeature::ENABLED | :maintainer | true
- :private | ProjectFeature::ENABLED | :developer | true
- :private | ProjectFeature::ENABLED | :guest | true
- :private | ProjectFeature::ENABLED | :anonymous | false
- :private | ProjectFeature::PRIVATE | :maintainer | true
- :private | ProjectFeature::PRIVATE | :developer | true
- :private | ProjectFeature::PRIVATE | :guest | true
- :private | ProjectFeature::PRIVATE | :anonymous | false
- :private | ProjectFeature::DISABLED | :maintainer | false
- :private | ProjectFeature::DISABLED | :developer | false
- :private | ProjectFeature::DISABLED | :guest | false
- :private | ProjectFeature::DISABLED | :anonymous | false
- end
+ shared_context 'with permission matrix' do
+ where(:project_visibility, :access_level, :role, :allowed) do
+ :public | ProjectFeature::ENABLED | :maintainer | true
+ :public | ProjectFeature::ENABLED | :developer | true
+ :public | ProjectFeature::ENABLED | :guest | true
+ :public | ProjectFeature::ENABLED | :anonymous | true
+ :public | ProjectFeature::PRIVATE | :maintainer | true
+ :public | ProjectFeature::PRIVATE | :developer | true
+ :public | ProjectFeature::PRIVATE | :guest | true
+ :public | ProjectFeature::PRIVATE | :anonymous | false
+ :public | ProjectFeature::DISABLED | :maintainer | false
+ :public | ProjectFeature::DISABLED | :developer | false
+ :public | ProjectFeature::DISABLED | :guest | false
+ :public | ProjectFeature::DISABLED | :anonymous | false
+ :internal | ProjectFeature::ENABLED | :maintainer | true
+ :internal | ProjectFeature::ENABLED | :developer | true
+ :internal | ProjectFeature::ENABLED | :guest | true
+ :internal | ProjectFeature::ENABLED | :anonymous | false
+ :internal | ProjectFeature::PRIVATE | :maintainer | true
+ :internal | ProjectFeature::PRIVATE | :developer | true
+ :internal | ProjectFeature::PRIVATE | :guest | true
+ :internal | ProjectFeature::PRIVATE | :anonymous | false
+ :internal | ProjectFeature::DISABLED | :maintainer | false
+ :internal | ProjectFeature::DISABLED | :developer | false
+ :internal | ProjectFeature::DISABLED | :guest | false
+ :internal | ProjectFeature::DISABLED | :anonymous | false
+ :private | ProjectFeature::ENABLED | :maintainer | true
+ :private | ProjectFeature::ENABLED | :developer | true
+ :private | ProjectFeature::ENABLED | :guest | true
+ :private | ProjectFeature::ENABLED | :anonymous | false
+ :private | ProjectFeature::PRIVATE | :maintainer | true
+ :private | ProjectFeature::PRIVATE | :developer | true
+ :private | ProjectFeature::PRIVATE | :guest | true
+ :private | ProjectFeature::PRIVATE | :anonymous | false
+ :private | ProjectFeature::DISABLED | :maintainer | false
+ :private | ProjectFeature::DISABLED | :developer | false
+ :private | ProjectFeature::DISABLED | :guest | false
+ :private | ProjectFeature::DISABLED | :anonymous | false
+ end
+ end
+
+ include_context 'with permission matrix'
with_them do
let(:current_user) { user_subject(role) }
@@ -2450,6 +2454,8 @@ RSpec.describe ProjectPolicy, feature_category: :system_access do
end
context 'when terraform state management is disabled' do
+ include_context 'with permission matrix'
+
before do
stub_config(terraform_state: { enabled: false })
end
diff --git a/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb b/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb
index a5cd3c8b019..3f071a6d987 100644
--- a/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb
+++ b/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb
@@ -37,11 +37,13 @@ RSpec.describe 'Updating an image DiffNote', feature_category: :team_planning do
end
let!(:diff_note) do
- create(:image_diff_note_on_merge_request,
- noteable: noteable,
- project: noteable.project,
- note: original_body,
- position: original_position)
+ create(
+ :image_diff_note_on_merge_request,
+ noteable: noteable,
+ project: noteable.project,
+ note: original_body,
+ position: original_position
+ )
end
let(:mutation) do
diff --git a/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb b/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb
index 2540e06be9a..5843109f356 100644
--- a/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb
+++ b/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb
@@ -17,14 +17,16 @@ RSpec.describe 'Updating the packages cleanup policy', feature_category: :packag
end
let(:mutation) do
- graphql_mutation(:update_packages_cleanup_policy, params,
- <<~QUERY
- packagesCleanupPolicy {
- keepNDuplicatedPackageFiles
- nextRunAt
- }
- errors
- QUERY
+ graphql_mutation(
+ :update_packages_cleanup_policy,
+ params,
+ <<~QUERY
+ packagesCleanupPolicy {
+ keepNDuplicatedPackageFiles
+ nextRunAt
+ }
+ errors
+ QUERY
)
end
diff --git a/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb b/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb
index 45028cba3ae..fdd4de865ad 100644
--- a/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb
+++ b/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb
@@ -10,12 +10,14 @@ RSpec.describe 'Updating an existing release asset link', feature_category: :rel
let_it_be(:developer) { create(:user).tap { |u| project.add_developer(u) } }
let_it_be(:release_link) do
- create(:release_link,
- release: release,
- name: 'link name',
- url: 'https://example.com/url',
- filepath: '/permanent/path',
- link_type: 'package')
+ create(
+ :release_link,
+ release: release,
+ name: 'link name',
+ url: 'https://example.com/url',
+ filepath: '/permanent/path',
+ link_type: 'package'
+ )
end
let(:current_user) { developer }
diff --git a/spec/requests/api/graphql/mutations/snippets/create_spec.rb b/spec/requests/api/graphql/mutations/snippets/create_spec.rb
index 338964e094f..7094cb807b2 100644
--- a/spec/requests/api/graphql/mutations/snippets/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/snippets/create_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe 'Creating a Snippet', feature_category: :source_code_management d
let(:current_user) { nil }
it_behaves_like 'a mutation that returns top-level errors',
- errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
it 'does not create the Snippet' do
expect do
@@ -122,7 +122,7 @@ RSpec.describe 'Creating a Snippet', feature_category: :source_code_management d
let(:project_path) { 'foobar' }
it_behaves_like 'a mutation that returns top-level errors',
- errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
end
context 'when the feature is disabled' do
@@ -131,7 +131,7 @@ RSpec.describe 'Creating a Snippet', feature_category: :source_code_management d
end
it_behaves_like 'a mutation that returns top-level errors',
- errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
end
it_behaves_like 'snippet edit usage data counters'
diff --git a/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb b/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb
index 186b60a1dff..7b0de7a9fba 100644
--- a/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb
+++ b/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe 'Destroying a Snippet', feature_category: :source_code_management
let(:current_user) { create(:user) }
it_behaves_like 'a mutation that returns top-level errors',
- errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
it 'does not destroy the Snippet' do
expect do
diff --git a/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb b/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb
index 9a8c027da8a..6fd41437ce4 100644
--- a/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb
+++ b/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe 'Mark snippet as spam', feature_category: :source_code_management
let(:current_user) { other_user }
it_behaves_like 'a mutation that returns top-level errors',
- errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
it_behaves_like 'does not mark the snippet as spam'
end
diff --git a/spec/requests/api/graphql/mutations/snippets/update_spec.rb b/spec/requests/api/graphql/mutations/snippets/update_spec.rb
index 78df78cb2a0..0bc475c7105 100644
--- a/spec/requests/api/graphql/mutations/snippets/update_spec.rb
+++ b/spec/requests/api/graphql/mutations/snippets/update_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d
let(:current_user) { create(:user) }
it_behaves_like 'a mutation that returns top-level errors',
- errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
+ errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
it 'does not update the Snippet' do
expect do
@@ -118,13 +118,15 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d
describe 'PersonalSnippet' do
let(:snippet) do
- create(:personal_snippet,
- :private,
- :repository,
- file_name: original_file_name,
- title: original_title,
- content: original_content,
- description: original_description)
+ create(
+ :personal_snippet,
+ :private,
+ :repository,
+ file_name: original_file_name,
+ title: original_title,
+ content: original_content,
+ description: original_description
+ )
end
it_behaves_like 'graphql update actions'
@@ -139,15 +141,17 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d
let_it_be(:project) { create(:project, :private) }
let(:snippet) do
- create(:project_snippet,
- :private,
- :repository,
- project: project,
- author: create(:user),
- file_name: original_file_name,
- title: original_title,
- content: original_content,
- description: original_description)
+ create(
+ :project_snippet,
+ :private,
+ :repository,
+ project: project,
+ author: create(:user),
+ file_name: original_file_name,
+ title: original_title,
+ content: original_content,
+ description: original_description
+ )
end
context 'when the author is not a member of the project' do
diff --git a/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb b/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb
index c611c6ee2a1..429aa06d9f1 100644
--- a/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb
+++ b/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb
@@ -21,12 +21,14 @@ RSpec.describe 'Marking all todos done', feature_category: :team_planning do
let(:input) { {} }
let(:mutation) do
- graphql_mutation(:todos_mark_all_done, input,
- <<-QL.strip_heredoc
- clientMutationId
- todos { id }
- errors
- QL
+ graphql_mutation(
+ :todos_mark_all_done,
+ input,
+ <<-QL.strip_heredoc
+ clientMutationId
+ todos { id }
+ errors
+ QL
)
end
diff --git a/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb b/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb
index 60700d8024c..c09f89ef567 100644
--- a/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb
+++ b/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb
@@ -19,15 +19,17 @@ RSpec.describe 'Marking todos done', feature_category: :team_planning do
let(:input) { { id: todo1.to_global_id.to_s } }
let(:mutation) do
- graphql_mutation(:todo_mark_done, input,
- <<-QL.strip_heredoc
- clientMutationId
- errors
- todo {
- id
- state
- }
- QL
+ graphql_mutation(
+ :todo_mark_done,
+ input,
+ <<-QL.strip_heredoc
+ clientMutationId
+ errors
+ todo {
+ id
+ state
+ }
+ QL
)
end
diff --git a/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb b/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb
index 9daa243cf8e..4bbfc7b2f1d 100644
--- a/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb
+++ b/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb
@@ -20,15 +20,17 @@ RSpec.describe 'Restoring many Todos', feature_category: :team_planning do
let(:input) { { ids: input_ids } }
let(:mutation) do
- graphql_mutation(:todo_restore_many, input,
- <<-QL.strip_heredoc
- clientMutationId
- errors
- todos {
- id
- state
- }
- QL
+ graphql_mutation(
+ :todo_restore_many,
+ input,
+ <<-QL.strip_heredoc
+ clientMutationId
+ errors
+ todos {
+ id
+ state
+ }
+ QL
)
end
diff --git a/spec/requests/api/graphql/mutations/todos/restore_spec.rb b/spec/requests/api/graphql/mutations/todos/restore_spec.rb
index 868298763ec..1ebd04432be 100644
--- a/spec/requests/api/graphql/mutations/todos/restore_spec.rb
+++ b/spec/requests/api/graphql/mutations/todos/restore_spec.rb
@@ -19,15 +19,17 @@ RSpec.describe 'Restoring Todos', feature_category: :team_planning do
let(:input) { { id: todo1.to_global_id.to_s } }
let(:mutation) do
- graphql_mutation(:todo_restore, input,
- <<-QL.strip_heredoc
- clientMutationId
- errors
- todo {
- id
- state
- }
- QL
+ graphql_mutation(
+ :todo_restore,
+ input,
+ <<-QL.strip_heredoc
+ clientMutationId
+ errors
+ todo {
+ id
+ state
+ }
+ QL
)
end
diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb
index b186d8ed0c2..c33273348f6 100644
--- a/spec/services/web_hook_service_spec.rb
+++ b/spec/services/web_hook_service_spec.rb
@@ -429,8 +429,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
.with(
project_hook.id,
hash_including(default_log_data.deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
service_instance.execute
@@ -460,8 +460,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
response_status: 400
).deep_stringify_keys
),
- :failed,
- nil
+ 'failed',
+ ''
)
service_instance.execute
@@ -484,8 +484,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
internal_error_message: 'Some HTTP Post error'
).deep_stringify_keys
),
- :error,
- nil
+ 'error',
+ ''
)
service_instance.execute
@@ -502,8 +502,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
.with(
project_hook.id,
hash_including(default_log_data.merge(response_body: '').deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
service_instance.execute
@@ -523,8 +523,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
.with(
project_hook.id,
hash_including(default_log_data.merge(response_body: stripped_body).deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
service_instance.execute
@@ -556,8 +556,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
.with(
project_hook.id,
hash_including(default_log_data.merge(response_headers: expected_response_headers).deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
service_instance.execute
@@ -581,8 +581,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
.with(
project_hook.id,
hash_including(default_log_data.merge(response_headers: expected_response_headers).deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
service_instance.execute
@@ -599,8 +599,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
.with(
project_hook.id,
hash_including(default_log_data.deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
.and_raise(
Gitlab::SidekiqMiddleware::SizeLimiter::ExceedLimitError.new(WebHooks::LogExecutionWorker, 100, 50)
@@ -612,8 +612,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state,
hash_including(default_log_data.merge(
request_data: WebHookLog::OVERSIZE_REQUEST_DATA
).deep_stringify_keys),
- :ok,
- nil
+ 'ok',
+ ''
)
.and_call_original
.ordered
diff --git a/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb
index effa6a6f6f0..c172e73ce9e 100644
--- a/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb
+++ b/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb
@@ -4,7 +4,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:|
let_it_be(:project) { create(:project) }
let_it_be_with_reload(:import_state) { create(factory, :started, project: project, jid: '123') }
let(:worker) { described_class.new }
- let(:next_stage) { :finish }
+ let(:next_stage) { 'finish' }
describe '#perform', :clean_gitlab_redis_shared_state do
context 'when the project no longer exists' do
@@ -60,7 +60,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:|
end
it 'schedules the next stage' do
- next_worker = described_class::STAGES[next_stage]
+ next_worker = described_class::STAGES[next_stage.to_sym]
expect_next_found_instance_of(import_state.class) do |state|
expect(state).to receive(:refresh_jid_expiration)
@@ -72,7 +72,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:|
end
it 'raises KeyError when the stage name is invalid' do
- expect { worker.perform(project.id, { '123' => 2 }, :kittens) }
+ expect { worker.perform(project.id, { '123' => 2 }, 'kittens') }
.to raise_error(KeyError)
end
end
@@ -106,7 +106,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:|
it 'advances to next stage' do
freeze_time do
- next_worker = described_class::STAGES[next_stage]
+ next_worker = described_class::STAGES[next_stage.to_sym]
expect(next_worker).to receive(:perform_async).with(project.id)
@@ -122,7 +122,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:|
it 'logs error and fails import' do
freeze_time do
- next_worker = described_class::STAGES[next_stage]
+ next_worker = described_class::STAGES[next_stage.to_sym]
expect(next_worker).not_to receive(:perform_async).with(project.id)
expect_next_instance_of(described_class) do |klass|
diff --git a/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb b/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb
index c04ccafdcf8..673988a3275 100644
--- a/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb
+++ b/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe Gitlab::BitbucketImport::AdvanceStageWorker, :clean_gitlab_redis_
expect(described_class)
.to receive(:perform_in)
- .with(described_class::INTERVAL, project.id, { '123' => 1 }, :finish, Time.zone.now, 1)
+ .with(described_class::INTERVAL, project.id, { '123' => 1 }, 'finish', Time.zone.now.to_s, 1)
worker.perform(project.id, { '123' => 2 }, :finish)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb
index 9a4b9106dae..c8b528593b9 100644
--- a/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportAttachmentsWorker, feature_cat
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2, '234' => 3, '345' => 4, '456' => 5 }, :protected_branches)
+ .with(project.id, { '123' => 2, '234' => 3, '345' => 4, '456' => 5 }, 'protected_branches')
worker.import(client, project)
end
@@ -62,7 +62,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportAttachmentsWorker, feature_cat
it 'skips release attachments import and calls next stage' do
importers.each { |importer| expect(importer[:klass]).not_to receive(:new) }
expect(Gitlab::GithubImport::AdvanceStageWorker)
- .to receive(:perform_async).with(project.id, {}, :protected_branches)
+ .to receive(:perform_async).with(project.id, {}, 'protected_branches')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb
index 71170718721..6a55f575da8 100644
--- a/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_c
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :pull_requests_merged_by)
+ .with(project.id, { '123' => 2 }, 'pull_requests_merged_by')
worker.import(client, project)
end
@@ -49,7 +49,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_c
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, {}, :pull_requests_merged_by)
+ .with(project.id, {}, 'pull_requests_merged_by')
worker.import(client, project)
end
@@ -63,7 +63,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_c
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, {}, :pull_requests_merged_by)
+ .with(project.id, {}, 'pull_requests_merged_by')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb
index 4b4d6a5b625..bad3a5beb0e 100644
--- a/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssueEventsWorker, feature_cat
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :notes)
+ .with(project.id, { '123' => 2 }, 'notes')
worker.import(client, project)
end
@@ -44,7 +44,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssueEventsWorker, feature_cat
it 'skips issue events import and calls next stage' do
expect(Gitlab::GithubImport::Importer::SingleEndpointIssueEventsImporter).not_to receive(:new)
- expect(Gitlab::GithubImport::AdvanceStageWorker).to receive(:perform_async).with(project.id, {}, :notes)
+ expect(Gitlab::GithubImport::AdvanceStageWorker).to receive(:perform_async).with(project.id, {}, 'notes')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb
index 7a5813122f4..10f6ebfbab9 100644
--- a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker, feat
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :issue_events)
+ .with(project.id, { '123' => 2 }, 'issue_events')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb
index 5d476543743..40194a91b3a 100644
--- a/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportLfsObjectsWorker, feature_cate
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :finish)
+ .with(project.id, { '123' => 2 }, 'finish')
worker.import(project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb
index 9584708802a..69078a666a5 100644
--- a/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportNotesWorker, feature_category:
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :attachments)
+ .with(project.id, { '123' => 2 }, 'attachments')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb
index 0bfae640e23..b73f8c6524d 100644
--- a/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker, featu
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :lfs_objects)
+ .with(project.id, { '123' => 2 }, 'lfs_objects')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb
index 158efce2a9e..b214f6a97d4 100644
--- a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker, fe
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :pull_request_review_requests)
+ .with(project.id, { '123' => 2 }, 'pull_request_review_requests')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb
index 8f71a18036b..4468de7e691 100644
--- a/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWork
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :pull_request_reviews)
+ .with(project.id, { '123' => 2 }, 'pull_request_reviews')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb
index f783baea349..48b41435adb 100644
--- a/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker, fea
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :issues_and_diff_notes)
+ .with(project.id, { '123' => 2 }, 'issues_and_diff_notes')
worker.import(client, project)
end
diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb
index c2b97335229..2ea66d8cdf3 100644
--- a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb
+++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb
@@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker, feature_ca
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :collaborators)
+ .with(project.id, { '123' => 2 }, 'collaborators')
expect(MergeRequest).to receive(:track_target_project_iid!)
@@ -64,7 +64,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker, feature_ca
expect(Gitlab::GithubImport::AdvanceStageWorker)
.to receive(:perform_async)
- .with(project.id, { '123' => 2 }, :collaborators)
+ .with(project.id, { '123' => 2 }, 'collaborators')
expect(MergeRequest).not_to receive(:track_target_project_iid!)