Commit 2f550f60 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'revert-946fc181' into 'master'

Revert "Merge branch '331835-use-rspec-sidekiq' into 'master'"

See merge request gitlab-org/gitlab!63894
parents d8ef4d47 2faf42a5
...@@ -1354,284 +1354,6 @@ RSpec/AnyInstanceOf: ...@@ -1354,284 +1354,6 @@ RSpec/AnyInstanceOf:
- 'spec/workers/wait_for_cluster_creation_worker_spec.rb' - 'spec/workers/wait_for_cluster_creation_worker_spec.rb'
- 'ee/spec/workers/security/auto_fix_worker_spec.rb' - 'ee/spec/workers/security/auto_fix_worker_spec.rb'
# WIP: https://gitlab.com/gitlab-org/gitlab/-/issues/331835
RSpec/HaveEnqueuedSidekiqJob:
Exclude:
- 'ee/spec/lib/gitlab/geo/log_cursor/events/job_artifact_deleted_event_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_deleted_event_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_renamed_event_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_updated_event_spec.rb'
- 'ee/spec/models/ci/pipeline_spec.rb'
- 'ee/spec/models/concerns/elastic/project_wiki_spec.rb'
- 'ee/spec/models/concerns/elastic/projects_search_spec.rb'
- 'ee/spec/models/ee/alert_management/alert_spec.rb'
- 'ee/spec/models/ee/user_spec.rb'
- 'ee/spec/models/elasticsearch_indexed_namespace_spec.rb'
- 'ee/spec/models/elasticsearch_indexed_project_spec.rb'
- 'ee/spec/models/gitlab/seat_link_data_spec.rb'
- 'ee/spec/models/group_wiki_spec.rb'
- 'ee/spec/models/namespace_statistics_spec.rb'
- 'ee/spec/models/project_feature_spec.rb'
- 'ee/spec/models/project_import_state_spec.rb'
- 'ee/spec/models/project_spec.rb'
- 'ee/spec/requests/api/elasticsearch_indexed_namespaces_spec.rb'
- 'ee/spec/requests/api/graphql/mutations/requirements_management/export_requirements_spec.rb'
- 'ee/spec/requests/api/project_mirror_spec.rb'
- 'ee/spec/requests/api/projects_spec.rb'
- 'ee/spec/services/admin/email_service_spec.rb'
- 'ee/spec/services/application_settings/update_service_spec.rb'
- 'ee/spec/services/auto_merge/merge_train_service_spec.rb'
- 'ee/spec/services/ci_cd/github_setup_service_spec.rb'
- 'ee/spec/services/dast_site_validations/create_service_spec.rb'
- 'ee/spec/services/ee/git/branch_push_service_spec.rb'
- 'ee/spec/services/ee/merge_requests/handle_assignees_change_service_spec.rb'
- 'ee/spec/services/ee/merge_requests/update_service_spec.rb'
- 'ee/spec/services/elastic/process_initial_bookkeeping_service_spec.rb'
- 'ee/spec/services/epics/update_dates_service_spec.rb'
- 'ee/spec/services/geo/container_repository_sync_service_spec.rb'
- 'ee/spec/services/geo/design_repository_sync_service_spec.rb'
- 'ee/spec/services/geo/framework_repository_sync_service_spec.rb'
- 'ee/spec/services/geo/hashed_storage_attachments_migration_service_spec.rb'
- 'ee/spec/services/geo/hashed_storage_migration_service_spec.rb'
- 'ee/spec/services/geo/project_housekeeping_service_spec.rb'
- 'ee/spec/services/geo/rename_repository_service_spec.rb'
- 'ee/spec/services/geo/repository_destroy_service_spec.rb'
- 'ee/spec/services/groups/transfer_service_spec.rb'
- 'ee/spec/services/milestones/destroy_service_spec.rb'
- 'ee/spec/services/projects/transfer_service_spec.rb'
- 'ee/spec/services/security/store_report_service_spec.rb'
- 'ee/spec/services/status_page/trigger_publish_service_spec.rb'
- 'ee/spec/services/web_hook_service_spec.rb'
- 'ee/spec/support/shared_examples/models/concerns/verifiable_replicator_shared_examples.rb'
- 'ee/spec/support/shared_examples/quick_actions/issue/status_page_quick_actions_shared_examples.rb'
- 'ee/spec/support/shared_examples/services/base_sync_service_shared_examples.rb'
- 'ee/spec/support/shared_examples/status_page/trigger_publish_shared_examples.rb'
- 'ee/spec/workers/build_finished_worker_spec.rb'
- 'ee/spec/workers/elastic_remove_expired_namespace_subscriptions_from_index_cron_worker_spec.rb'
- 'ee/spec/workers/geo/container_repository_sync_dispatch_worker_spec.rb'
- 'ee/spec/workers/geo/design_repository_shard_sync_worker_spec.rb'
- 'ee/spec/workers/geo/file_download_dispatch_worker_spec.rb'
- 'ee/spec/workers/geo/registry_sync_worker_spec.rb'
- 'ee/spec/workers/geo/repositories_clean_up_worker_spec.rb'
- 'ee/spec/workers/geo/repository_shard_sync_worker_spec.rb'
- 'ee/spec/workers/geo/repository_verification/primary/batch_worker_spec.rb'
- 'ee/spec/workers/geo/repository_verification/primary/shard_worker_spec.rb'
- 'ee/spec/workers/geo/repository_verification/secondary/scheduler_worker_spec.rb'
- 'ee/spec/workers/geo/repository_verification/secondary/shard_worker_spec.rb'
- 'ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb'
- 'ee/spec/workers/incident_management/oncall_rotations/persist_all_rotations_shifts_job_spec.rb'
- 'ee/spec/workers/post_receive_spec.rb'
- 'ee/spec/workers/store_security_reports_worker_spec.rb'
- 'ee/spec/workers/sync_seat_link_worker_spec.rb'
- 'spec/controllers/admin/clusters_controller_spec.rb'
- 'spec/controllers/admin/services_controller_spec.rb'
- 'spec/controllers/chaos_controller_spec.rb'
- 'spec/controllers/groups/clusters_controller_spec.rb'
- 'spec/controllers/groups_controller_spec.rb'
- 'spec/controllers/projects/clusters_controller_spec.rb'
- 'spec/controllers/projects/issues_controller_spec.rb'
- 'spec/controllers/projects/merge_requests_controller_spec.rb'
- 'spec/controllers/projects/pipeline_schedules_controller_spec.rb'
- 'spec/controllers/projects/registry/repositories_controller_spec.rb'
- 'spec/controllers/projects/settings/ci_cd_controller_spec.rb'
- 'spec/controllers/repositories/git_http_controller_spec.rb'
- 'spec/features/admin/admin_uses_repository_checks_spec.rb'
- 'spec/features/clusters/installing_applications_shared_examples.rb'
- 'spec/features/issues/csv_spec.rb'
- 'spec/graphql/mutations/container_repositories/destroy_spec.rb'
- 'spec/graphql/mutations/merge_requests/accept_spec.rb'
- 'spec/lib/gitlab/ci/pipeline/chain/pipeline/process_spec.rb'
- 'spec/lib/gitlab/cleanup/orphan_lfs_file_references_spec.rb'
- 'spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb'
- 'spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb'
- 'spec/lib/gitlab/github_import/importer/issues_importer_spec.rb'
- 'spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb'
- 'spec/lib/gitlab/github_import/importer/notes_importer_spec.rb'
- 'spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb'
- 'spec/lib/gitlab/jira_import/issues_importer_spec.rb'
- 'spec/lib/gitlab/pages_transfer_spec.rb'
- 'spec/models/abuse_report_spec.rb'
- 'spec/models/ci/build_spec.rb'
- 'spec/models/ci/build_trace_chunk_spec.rb'
- 'spec/models/ci/job_artifact_spec.rb'
- 'spec/models/ci/pipeline_spec.rb'
- 'spec/models/ci/processable_spec.rb'
- 'spec/models/clusters/integrations/prometheus_spec.rb'
- 'spec/models/commit_status_spec.rb'
- 'spec/models/concerns/reactive_caching_spec.rb'
- 'spec/models/deployment_spec.rb'
- 'spec/models/diff_note_spec.rb'
- 'spec/models/integrations/emails_on_push_spec.rb'
- 'spec/models/issue_spec.rb'
- 'spec/models/jira_import_state_spec.rb'
- 'spec/models/key_spec.rb'
- 'spec/models/lfs_object_spec.rb'
- 'spec/models/lfs_objects_project_spec.rb'
- 'spec/models/merge_request_spec.rb'
- 'spec/models/namespace/aggregation_schedule_spec.rb'
- 'spec/models/namespace_spec.rb'
- 'spec/models/operations/feature_flag_spec.rb'
- 'spec/models/packages/package_spec.rb'
- 'spec/models/pages_domain_spec.rb'
- 'spec/models/pool_repository_spec.rb'
- 'spec/models/project_import_state_spec.rb'
- 'spec/models/project_services/prometheus_service_spec.rb'
- 'spec/models/project_spec.rb'
- 'spec/models/project_statistics_spec.rb'
- 'spec/models/project_wiki_spec.rb'
- 'spec/models/remote_mirror_spec.rb'
- 'spec/models/sentry_issue_spec.rb'
- 'spec/models/snippet_statistics_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/models/x509_certificate_spec.rb'
- 'spec/requests/api/dependency_proxy_spec.rb'
- 'spec/requests/api/graphql/mutations/container_repository/destroy_spec.rb'
- 'spec/requests/api/group_import_spec.rb'
- 'spec/requests/api/merge_requests_spec.rb'
- 'spec/requests/api/project_container_repositories_spec.rb'
- 'spec/requests/api/project_packages_spec.rb'
- 'spec/requests/lfs_http_spec.rb'
- 'spec/services/admin/propagate_integration_service_spec.rb'
- 'spec/services/admin/propagate_service_template_spec.rb'
- 'spec/services/application_settings/update_service_spec.rb'
- 'spec/services/auto_merge/merge_when_pipeline_succeeds_service_spec.rb'
- 'spec/services/branches/delete_merged_service_spec.rb'
- 'spec/services/branches/delete_service_spec.rb'
- 'spec/services/bulk_import_service_spec.rb'
- 'spec/services/bulk_imports/export_service_spec.rb'
- 'spec/services/ci/create_pipeline_service_spec.rb'
- 'spec/services/ci/list_config_variables_service_spec.rb'
- 'spec/services/ci/pipeline_schedule_service_spec.rb'
- 'spec/services/ci/play_bridge_service_spec.rb'
- 'spec/services/ci/test_failure_history_service_spec.rb'
- 'spec/services/ci/update_build_state_service_spec.rb'
- 'spec/services/clusters/applications/create_service_spec.rb'
- 'spec/services/clusters/applications/schedule_update_service_spec.rb'
- 'spec/services/clusters/applications/update_service_spec.rb'
- 'spec/services/clusters/cleanup/app_service_spec.rb'
- 'spec/services/clusters/cleanup/project_namespace_service_spec.rb'
- 'spec/services/clusters/create_service_spec.rb'
- 'spec/services/container_expiration_policy_service_spec.rb'
- 'spec/services/deployments/create_service_spec.rb'
- 'spec/services/design_management/delete_designs_service_spec.rb'
- 'spec/services/discussions/resolve_service_spec.rb'
- 'spec/services/feature_flags/create_service_spec.rb'
- 'spec/services/feature_flags/update_service_spec.rb'
- 'spec/services/git/branch_hooks_service_spec.rb'
- 'spec/services/git/branch_push_service_spec.rb'
- 'spec/services/git/tag_push_service_spec.rb'
- 'spec/services/grafana/proxy_service_spec.rb'
- 'spec/services/groups/import_export/import_service_spec.rb'
- 'spec/services/groups/transfer_service_spec.rb'
- 'spec/services/groups/update_service_spec.rb'
- 'spec/services/incident_management/pager_duty/process_webhook_service_spec.rb'
- 'spec/services/issuable/bulk_update_service_spec.rb'
- 'spec/services/issues/create_service_spec.rb'
- 'spec/services/issues/update_service_spec.rb'
- 'spec/services/members/destroy_service_spec.rb'
- 'spec/services/merge_requests/handle_assignees_change_service_spec.rb'
- 'spec/services/merge_requests/merge_service_spec.rb'
- 'spec/services/merge_requests/mergeability_check_service_spec.rb'
- 'spec/services/merge_requests/resolve_todos_service_spec.rb'
- 'spec/services/metrics/dashboard/grafana_metric_embed_service_spec.rb'
- 'spec/services/notes/create_service_spec.rb'
- 'spec/services/notification_service_spec.rb'
- 'spec/services/onboarding_progress_service_spec.rb'
- 'spec/services/packages/composer/create_package_service_spec.rb'
- 'spec/services/packages/debian/process_changes_service_spec.rb'
- 'spec/services/packages/go/sync_packages_service_spec.rb'
- 'spec/services/pages/delete_service_spec.rb'
- 'spec/services/post_receive_service_spec.rb'
- 'spec/services/projects/after_rename_service_spec.rb'
- 'spec/services/projects/create_service_spec.rb'
- 'spec/services/projects/group_links/create_service_spec.rb'
- 'spec/services/projects/group_links/destroy_service_spec.rb'
- 'spec/services/projects/repository_languages_service_spec.rb'
- 'spec/services/projects/transfer_service_spec.rb'
- 'spec/services/projects/update_service_spec.rb'
- 'spec/services/prometheus/proxy_service_spec.rb'
- 'spec/services/resource_access_tokens/revoke_service_spec.rb'
- 'spec/services/snippets/destroy_service_spec.rb'
- 'spec/services/snippets/update_statistics_service_spec.rb'
- 'spec/services/tags/destroy_service_spec.rb'
- 'spec/services/todos/destroy/entity_leave_service_spec.rb'
- 'spec/services/web_hook_service_spec.rb'
- 'spec/support/services/clusters/create_service_shared.rb'
- 'spec/support/shared_examples/controllers/access_tokens_controller_shared_examples.rb'
- 'spec/support/shared_examples/models/update_project_statistics_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/nuget_packages_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/rubygems_packages_shared_examples.rb'
- 'spec/support/shared_examples/services/alert_management/alert_processing/incident_creation_shared_examples.rb'
- 'spec/support/shared_examples/services/issuable/destroy_service_shared_examples.rb'
- 'spec/support/shared_examples/services/packages_shared_examples.rb'
- 'spec/support/shared_examples/workers/gitlab/jira_import/jira_import_workers_shared_examples.rb'
- 'spec/tasks/gitlab/storage_rake_spec.rb'
- 'spec/uploaders/external_diff_uploader_spec.rb'
- 'spec/uploaders/lfs_object_uploader_spec.rb'
- 'spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb'
- 'spec/workers/build_finished_worker_spec.rb'
- 'spec/workers/bulk_import_worker_spec.rb'
- 'spec/workers/bulk_imports/entity_worker_spec.rb'
- 'spec/workers/bulk_imports/pipeline_worker_spec.rb'
- 'spec/workers/deployments/execute_hooks_worker_spec.rb'
- 'spec/workers/deployments/hooks_worker_spec.rb'
- 'spec/workers/export_csv_worker_spec.rb'
- 'spec/workers/gitlab/github_import/advance_stage_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_base_data_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb'
- 'spec/workers/gitlab/github_import/stage/import_repository_worker_spec.rb'
- 'spec/workers/gitlab/jira_import/stage/start_import_worker_spec.rb'
- 'spec/workers/issue_placement_worker_spec.rb'
- 'spec/workers/metrics/dashboard/schedule_annotations_prune_worker_spec.rb'
- 'spec/workers/pages_domain_ssl_renewal_cron_worker_spec.rb'
- 'spec/workers/pages_domain_verification_cron_worker_spec.rb'
- 'spec/workers/post_receive_spec.rb'
- 'spec/workers/project_cache_worker_spec.rb'
- 'spec/workers/repository_check/dispatch_worker_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/daemon_spec.rb'
- 'ee/spec/lib/gitlab/geo/log_cursor/events/repository_created_event_spec.rb'
- 'ee/spec/models/merge_train_spec.rb'
- 'ee/spec/services/iterations/cadences/create_service_spec.rb'
- 'ee/spec/workers/incident_management/incident_sla_exceeded_check_worker_spec.rb'
- 'ee/spec/workers/iterations/cadences/schedule_create_iterations_worker_spec.rb'
- 'spec/controllers/admin/clusters/applications_controller_spec.rb'
- 'spec/controllers/groups/clusters/applications_controller_spec.rb'
- 'spec/controllers/projects/clusters/applications_controller_spec.rb'
- 'spec/controllers/projects/mirrors_controller_spec.rb'
- 'spec/lib/gitlab/background_migration_spec.rb'
- 'spec/lib/gitlab/github_import/parallel_importer_spec.rb'
- 'spec/requests/api/ci/pipeline_schedules_spec.rb'
- 'spec/services/auto_merge/base_service_spec.rb'
- 'spec/services/git/process_ref_changes_service_spec.rb'
- 'spec/services/merge_requests/base_service_spec.rb'
- 'spec/services/web_hooks/destroy_service_spec.rb'
- 'spec/workers/container_expiration_policy_worker_spec.rb'
- 'spec/workers/namespaces/prune_aggregation_schedules_worker_spec.rb'
- 'ee/spec/services/elastic/indexing_control_service_spec.rb'
- 'ee/spec/support/shared_examples/lib/gitlab/geo/geo_log_cursor_event_shared_examples.rb'
- 'ee/spec/workers/geo/repository_sync_worker_spec.rb'
- 'ee/spec/workers/update_all_mirrors_worker_spec.rb'
- 'spec/lib/gitlab/github_import/parallel_scheduling_spec.rb'
- 'spec/models/clusters/cluster_spec.rb'
- 'spec/services/clusters/applications/destroy_service_spec.rb'
- 'spec/support/shared_examples/models/concerns/repository_storage_movable_shared_examples.rb'
- 'spec/support/shared_examples/requests/api/repository_storage_moves_shared_examples.rb'
- 'spec/support/shared_examples/requests/self_monitoring_shared_examples.rb'
- 'spec/support/shared_examples/services/repositories/housekeeping_shared_examples.rb'
- 'spec/support/shared_examples/services/schedule_bulk_repository_shard_moves_shared_examples.rb'
- 'spec/uploaders/workers/object_storage/migrate_uploads_worker_spec.rb'
- 'spec/workers/concerns/limited_capacity/worker_spec.rb'
- 'spec/workers/concerns/reenqueuer_spec.rb'
- 'spec/workers/gitlab/phabricator_import/base_worker_spec.rb'
- 'spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb'
# WIP: https://gitlab.com/gitlab-org/gitlab/-/issues/321982 # WIP: https://gitlab.com/gitlab-org/gitlab/-/issues/321982
Gitlab/NamespacedClass: Gitlab/NamespacedClass:
Exclude: Exclude:
......
...@@ -432,7 +432,6 @@ group :test do ...@@ -432,7 +432,6 @@ group :test do
gem 'concurrent-ruby', '~> 1.1' gem 'concurrent-ruby', '~> 1.1'
gem 'test-prof', '~> 0.12.0' gem 'test-prof', '~> 0.12.0'
gem 'rspec_junit_formatter' gem 'rspec_junit_formatter'
gem 'rspec-sidekiq'
gem 'guard-rspec' gem 'guard-rspec'
# Moved in `test` because https://gitlab.com/gitlab-org/gitlab/-/issues/217527 # Moved in `test` because https://gitlab.com/gitlab-org/gitlab/-/issues/217527
......
...@@ -1090,9 +1090,6 @@ GEM ...@@ -1090,9 +1090,6 @@ GEM
rspec-support (~> 3.10) rspec-support (~> 3.10)
rspec-retry (0.6.1) rspec-retry (0.6.1)
rspec-core (> 3.3) rspec-core (> 3.3)
rspec-sidekiq (3.1.0)
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.10.2) rspec-support (3.10.2)
rspec_junit_formatter (0.4.1) rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0) rspec-core (>= 2, < 4, != 2.12.0)
...@@ -1608,7 +1605,6 @@ DEPENDENCIES ...@@ -1608,7 +1605,6 @@ DEPENDENCIES
rspec-parameterized rspec-parameterized
rspec-rails (~> 5.0.1) rspec-rails (~> 5.0.1)
rspec-retry (~> 0.6.1) rspec-retry (~> 0.6.1)
rspec-sidekiq
rspec_junit_formatter rspec_junit_formatter
rspec_profiling (~> 0.0.6) rspec_profiling (~> 0.0.6)
ruby-fogbugz (~> 0.2.1) ruby-fogbugz (~> 0.2.1)
......
...@@ -259,9 +259,9 @@ it 'sets the frobulance' do ...@@ -259,9 +259,9 @@ it 'sets the frobulance' do
end end
it 'schedules a background job' do it 'schedules a background job' do
subject.execute expect(BackgroundJob).to receive(:perform_async)
expect(BackgroundJob).to have_enqueued_sidekiq_job subject.execute
end end
``` ```
...@@ -271,11 +271,11 @@ combining the examples: ...@@ -271,11 +271,11 @@ combining the examples:
```ruby ```ruby
it 'performs the expected side-effects' do it 'performs the expected side-effects' do
expect(BackgroundJob).to receive(:perform_async)
expect { subject.execute } expect { subject.execute }
.to change(Event, :count).by(1) .to change(Event, :count).by(1)
.and change { arg_0.frobulance }.to('wibble') .and change { arg_0.frobulance }.to('wibble')
expect(BackgroundJob).to have_enqueued_sidekiq_job
end end
``` ```
...@@ -738,28 +738,6 @@ The usage of `perform_enqueued_jobs` is useful only for testing delayed mail ...@@ -738,28 +738,6 @@ The usage of `perform_enqueued_jobs` is useful only for testing delayed mail
deliveries, because our Sidekiq workers aren't inheriting from `ApplicationJob` deliveries, because our Sidekiq workers aren't inheriting from `ApplicationJob`
/ `ActiveJob::Base`. / `ActiveJob::Base`.
GitLab uses the [RSpec-Sidekiq](https://github.com/philostler/rspec-sidekiq) gem for expectations.
We prefer you check that a job has been enqueued, rather than checking the worker has
`received` the `perform_async` method:
```ruby
# bad
expect(Worker).to receive(:perform_async).with(1, 'string')
# Good
expect(Worker).to have_enqueued_sidekiq_job(1, 'string')
```
The only exception to this rule: if the spec actually needs to make sure the job is
enqueued only once, or a specific number of times:
```ruby
# good
expect(Worker).to receive(:perform_async).with(1, 'string').once
```
If you need test that the job is only enqueued a specific number of times, you will have to disable the cop
that enforces usage of `have_enqueued_sidekiq_job` (`RSpec/HaveEnqueuedSidekiqJob`) in that test.
#### DNS #### DNS
DNS requests are stubbed universally in the test suite DNS requests are stubbed universally in the test suite
......
...@@ -146,9 +146,10 @@ RSpec.describe RegistrationsController do ...@@ -146,9 +146,10 @@ RSpec.describe RegistrationsController do
end end
it 'redirects without deleting the account' do it 'redirects without deleting the account' do
expect(DeleteUserWorker).not_to receive(:perform_async)
post :destroy, params: { username: user.username } post :destroy, params: { username: user.username }
expect(DeleteUserWorker).not_to have_enqueued_sidekiq_job
expect(flash[:alert]).to eq 'Account could not be deleted. GitLab was unable to verify your identity.' expect(flash[:alert]).to eq 'Account could not be deleted. GitLab was unable to verify your identity.'
expect(response).to have_gitlab_http_status(:see_other) expect(response).to have_gitlab_http_status(:see_other)
expect(response).to redirect_to profile_account_path expect(response).to redirect_to profile_account_path
......
...@@ -328,16 +328,17 @@ RSpec.describe Projects::MergeRequestsController do ...@@ -328,16 +328,17 @@ RSpec.describe Projects::MergeRequestsController do
end end
def expect_rebase_worker_for(user) def expect_rebase_worker_for(user)
expect(RebaseWorker).to have_enqueued_sidekiq_job(merge_request.id, user.id, false) expect(RebaseWorker).to receive(:perform_async).with(merge_request.id, user.id, false)
end end
context 'approvals pending' do context 'approvals pending' do
let(:project) { create(:project, :repository, approvals_before_merge: 1) } let(:project) { create(:project, :repository, approvals_before_merge: 1) }
it 'returns 200' do it 'returns 200' do
expect_rebase_worker_for(viewer)
post_rebase post_rebase
expect_rebase_worker_for(viewer)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
end end
end end
......
...@@ -55,14 +55,10 @@ RSpec.describe Mutations::RequirementsManagement::ExportRequirements do ...@@ -55,14 +55,10 @@ RSpec.describe Mutations::RequirementsManagement::ExportRequirements do
end end
it 'exports requirements' do it 'exports requirements' do
subject expect(IssuableExportCsvWorker).to receive(:perform_async)
.with(:requirement, user.id, project.id, args.except(:project_path))
expect(IssuableExportCsvWorker).to have_enqueued_sidekiq_job( subject
:requirement,
user.id,
project.id,
args.except(:project_path)
)
end end
end end
......
...@@ -55,10 +55,11 @@ RSpec.describe Analytics::MergeRequestMetricsRefresh do ...@@ -55,10 +55,11 @@ RSpec.describe Analytics::MergeRequestMetricsRefresh do
describe '#execute_async' do describe '#execute_async' do
it 'schedules CodeReviewMetricsWorker with params' do it 'schedules CodeReviewMetricsWorker with params' do
subject.execute_async(force: true)
expect(Analytics::CodeReviewMetricsWorker) expect(Analytics::CodeReviewMetricsWorker)
.to have_enqueued_sidekiq_job('MyTestClass', merge_request.id, force: true) .to receive(:perform_async)
.with('MyTestClass', merge_request.id, force: true)
subject.execute_async(force: true)
end end
end end
end end
...@@ -39,10 +39,10 @@ RSpec.describe Gitlab::BackgroundMigration::PopulateNamespaceStatistics do ...@@ -39,10 +39,10 @@ RSpec.describe Gitlab::BackgroundMigration::PopulateNamespaceStatistics do
expect(namespace_statistics.count).to eq 1 expect(namespace_statistics.count).to eq 1
subject expect(Namespaces::ScheduleAggregationWorker).to receive(:perform_async).with(group1.id)
expect(Namespaces::ScheduleAggregationWorker).to receive(:perform_async).with(group2.id)
expect(Namespaces::ScheduleAggregationWorker).to have_enqueued_sidekiq_job(group1.id) subject
expect(Namespaces::ScheduleAggregationWorker).to have_enqueued_sidekiq_job(group2.id)
expect(namespace_statistics.count).to eq 2 expect(namespace_statistics.count).to eq 2
......
...@@ -54,9 +54,9 @@ RSpec.describe Gitlab::Auth::GroupSaml::MembershipUpdater do ...@@ -54,9 +54,9 @@ RSpec.describe Gitlab::Auth::GroupSaml::MembershipUpdater do
end end
it 'does not enqueue group sync' do it 'does not enqueue group sync' do
update_membership expect(GroupSamlGroupSyncWorker).not_to receive(:perform_async)
expect(GroupSamlGroupSyncWorker).not_to have_enqueued_sidekiq_job update_membership
end end
context 'when SAML group links exist' do context 'when SAML group links exist' do
...@@ -73,34 +73,30 @@ RSpec.describe Gitlab::Auth::GroupSaml::MembershipUpdater do ...@@ -73,34 +73,30 @@ RSpec.describe Gitlab::Auth::GroupSaml::MembershipUpdater do
end end
it 'does not enqueue group sync' do it 'does not enqueue group sync' do
expect(GroupSamlGroupSyncWorker).not_to have_enqueued_sidekiq_job expect(GroupSamlGroupSyncWorker).not_to receive(:perform_async)
end end
end end
context 'when group sync is available' do context 'when group sync is available' do
before do before do
stub_saml_group_sync_available(true) stub_saml_group_sync_available(true)
group_link
subgroup_link
end end
it 'enqueues group sync' do it 'enqueues group sync' do
update_membership expect(GroupSamlGroupSyncWorker).to receive(:perform_async).with(user.id, group.id, match_array([group_link.id, subgroup_link.id]))
expect(GroupSamlGroupSyncWorker).to have_enqueued_sidekiq_job(user.id, group.id, match_array([group_link.id, subgroup_link.id])) update_membership
end end
context 'with a group link outside the top-level group' do context 'with a group link outside the top-level group' do
before do before do
create(:saml_group_link, saml_group_name: 'Developers', group: create(:group)) create(:saml_group_link, saml_group_name: 'Developers', group: create(:group))
group_link
subgroup_link
end end
it 'enqueues group sync without the outside group' do it 'enqueues group sync without the outside group' do
update_membership expect(GroupSamlGroupSyncWorker).to receive(:perform_async).with(user.id, group.id, match_array([group_link.id, subgroup_link.id]))
expect(GroupSamlGroupSyncWorker).to have_enqueued_sidekiq_job(user.id, group.id, match_array([group_link.id, subgroup_link.id])) update_membership
end end
end end
end end
......
...@@ -233,9 +233,10 @@ RSpec.describe Gitlab::Auth::Ldap::Access do ...@@ -233,9 +233,10 @@ RSpec.describe Gitlab::Auth::Ldap::Access do
group_link_2 = create(:ldap_group_link, cn: 'Group2', provider: provider) group_link_2 = create(:ldap_group_link, cn: 'Group2', provider: provider)
group_ids = [group_link_1, group_link_2].map(&:group_id) group_ids = [group_link_1, group_link_2].map(&:group_id)
access.update_user expect(LdapGroupSyncWorker).to receive(:perform_async)
.with(a_collection_containing_exactly(*group_ids), provider)
expect(LdapGroupSyncWorker).to have_enqueued_sidekiq_job(a_collection_containing_exactly(*group_ids), provider) access.update_user
end end
it "doesn't trigger a sync when in a read-only GitLab instance" do it "doesn't trigger a sync when in a read-only GitLab instance" do
...@@ -243,9 +244,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do ...@@ -243,9 +244,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do
create(:ldap_group_link, cn: 'Group1', provider: provider) create(:ldap_group_link, cn: 'Group1', provider: provider)
create(:ldap_group_link, cn: 'Group2', provider: provider) create(:ldap_group_link, cn: 'Group2', provider: provider)
access.update_user expect(LdapGroupSyncWorker).not_to receive(:perform_async)
expect(LdapGroupSyncWorker).not_to have_enqueued_sidekiq_job access.update_user
end end
it "doesn't trigger a sync when there are no links for the provider" do it "doesn't trigger a sync when there are no links for the provider" do
...@@ -253,9 +254,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do ...@@ -253,9 +254,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do
cn: 'Group1', cn: 'Group1',
provider: 'not-this-ldap') provider: 'not-this-ldap')
access.update_user expect(LdapGroupSyncWorker).not_to receive(:perform_async)
expect(LdapGroupSyncWorker).not_to have_enqueued_sidekiq_job access.update_user
end end
it 'does not performs the membership update for existing users' do it 'does not performs the membership update for existing users' do
...@@ -264,10 +265,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do ...@@ -264,10 +265,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do
user.save user.save
expect(LdapGroupLink).not_to receive(:where) expect(LdapGroupLink).not_to receive(:where)
expect(LdapGroupSyncWorker).not_to receive(:perform_async)
access.update_user access.update_user
expect(LdapGroupSyncWorker).not_to have_enqueued_sidekiq_job
end end
end end
...@@ -275,10 +275,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do ...@@ -275,10 +275,9 @@ RSpec.describe Gitlab::Auth::Ldap::Access do
stub_ldap_person_find_by_dn(entry, provider) stub_ldap_person_find_by_dn(entry, provider)
expect(LdapGroupLink).not_to receive(:where) expect(LdapGroupLink).not_to receive(:where)
expect(LdapGroupSyncWorker).not_to receive(:perform_async)
access.update_user access.update_user
expect(LdapGroupSyncWorker).not_to have_enqueued_sidekiq_job
end end
end end
......
...@@ -173,9 +173,9 @@ RSpec.describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state ...@@ -173,9 +173,9 @@ RSpec.describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state
it 'does not replay events for projects that do not belong to selected namespaces to replicate' do it 'does not replay events for projects that do not belong to selected namespaces to replicate' do
secondary.update!(selective_sync_type: 'namespaces', namespaces: [group_2]) secondary.update!(selective_sync_type: 'namespaces', namespaces: [group_2])
daemon.find_and_handle_events! expect(Geo::ProjectSyncWorker).not_to receive(:perform_async).with(project.id, anything)
expect(Geo::ProjectSyncWorker).not_to have_enqueued_sidekiq_job(project.id, anything) daemon.find_and_handle_events!
end end
it 'detects when an event was skipped' do it 'detects when an event was skipped' do
...@@ -240,9 +240,9 @@ RSpec.describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state ...@@ -240,9 +240,9 @@ RSpec.describe Gitlab::Geo::LogCursor::Daemon, :clean_gitlab_redis_shared_state
it 'does not replay events for projects that do not belong to selected shards to replicate' do it 'does not replay events for projects that do not belong to selected shards to replicate' do
secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken']) secondary.update!(selective_sync_type: 'shards', selective_sync_shards: ['broken'])
daemon.find_and_handle_events! expect(Geo::ProjectSyncWorker).not_to receive(:perform_async).with(project.id, anything)
expect(Geo::ProjectSyncWorker).not_to have_enqueued_sidekiq_job(project.id, anything) daemon.find_and_handle_events!
end end
end end
end end
......
...@@ -13,13 +13,13 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::Event, :clean_gitlab_redis_shared ...@@ -13,13 +13,13 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::Event, :clean_gitlab_redis_shared
describe "#process" do describe "#process" do
it "enqueues Geo::EventWorker" do it "enqueues Geo::EventWorker" do
subject.process expect(::Geo::EventWorker).to receive(:perform_async).with(
expect(::Geo::EventWorker).to have_enqueued_sidekiq_job(
"package_file", "package_file",
"created", "created",
{ "model_record_id" => replicable.id } { "model_record_id" => replicable.id }
) )
subject.process
end end
it "eventually calls Replicator#consume", :sidekiq_inline do it "eventually calls Replicator#consume", :sidekiq_inline do
......
...@@ -13,19 +13,20 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::HashedStorageAttachmentsEvent, :c ...@@ -13,19 +13,20 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::HashedStorageAttachmentsEvent, :c
subject { described_class.new(hashed_storage_attachments_event, Time.now, logger) } subject { described_class.new(hashed_storage_attachments_event, Time.now, logger) }
around do |example|
Sidekiq::Testing.fake! { example.run }
end
describe '#process' do describe '#process' do
it 'does not create a new project registry' do it 'does not create a new project registry' do
expect { subject.process }.not_to change(Geo::ProjectRegistry, :count) expect { subject.process }.not_to change(Geo::ProjectRegistry, :count)
end end
it 'schedules a Geo::HashedStorageAttachmentsMigrationWorker' do it 'schedules a Geo::HashedStorageAttachmentsMigrationWorker' do
subject.process expect(::Geo::HashedStorageAttachmentsMigrationWorker).to receive(:perform_async)
.with(project.id, old_attachments_path, new_attachments_path)
expect(::Geo::HashedStorageAttachmentsMigrationWorker).to have_enqueued_sidekiq_job( subject.process
project.id,
old_attachments_path,
new_attachments_path
)
end end
it_behaves_like 'logs event source info' it_behaves_like 'logs event source info'
......
...@@ -14,6 +14,10 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::HashedStorageMigratedEvent, :clea ...@@ -14,6 +14,10 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::HashedStorageMigratedEvent, :clea
subject { described_class.new(hashed_storage_migrated_event, Time.now, logger) } subject { described_class.new(hashed_storage_migrated_event, Time.now, logger) }
around do |example|
Sidekiq::Testing.fake! { example.run }
end
describe '#process' do describe '#process' do
context 'when a tracking entry does not exist' do context 'when a tracking entry does not exist' do
it 'does not create a tracking entry' do it 'does not create a tracking entry' do
...@@ -21,23 +25,20 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::HashedStorageMigratedEvent, :clea ...@@ -21,23 +25,20 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::HashedStorageMigratedEvent, :clea
end end
it 'does not schedule a Geo::HashedStorageMigrationWorker' do it 'does not schedule a Geo::HashedStorageMigrationWorker' do
subject.process expect(::Geo::HashedStorageMigrationWorker).not_to receive(:perform_async)
.with(project.id, old_disk_path, new_disk_path, old_storage_version)
expect(::Geo::HashedStorageMigrationWorker).not_to have_enqueued_sidekiq_job subject.process
end end
end end
it 'schedules a Geo::HashedStorageMigrationWorker' do it 'schedules a Geo::HashedStorageMigrationWorker' do
create(:geo_project_registry, project: project) create(:geo_project_registry, project: project)
subject.process expect(::Geo::HashedStorageMigrationWorker).to receive(:perform_async)
.with(project.id, old_disk_path, new_disk_path, old_storage_version)
expect(::Geo::HashedStorageMigrationWorker).to have_enqueued_sidekiq_job( subject.process
project.id,
old_disk_path,
new_disk_path,
old_storage_version
)
end end
it_behaves_like 'logs event source info' it_behaves_like 'logs event source info'
......
...@@ -82,9 +82,9 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::RepositoryCreatedEvent, :clean_gi ...@@ -82,9 +82,9 @@ RSpec.describe Gitlab::Geo::LogCursor::Events::RepositoryCreatedEvent, :clean_gi
it_behaves_like 'RepositoryCreatedEvent' it_behaves_like 'RepositoryCreatedEvent'
it 'does not schedule a Geo::ProjectSyncWorker job' do it 'does not schedule a Geo::ProjectSyncWorker job' do
subject.process expect(Geo::ProjectSyncWorker).not_to receive(:perform_async).with(project.id, anything)
expect(Geo::ProjectSyncWorker).not_to have_enqueued_sidekiq_job subject.process
end end
end end
end end
......
...@@ -270,11 +270,11 @@ RSpec.describe ApplicationSetting do ...@@ -270,11 +270,11 @@ RSpec.describe ApplicationSetting do
end end
it 'resumes indexing' do it 'resumes indexing' do
expect(ElasticIndexingControlWorker).to receive(:perform_async)
setting.save! setting.save!
setting.elasticsearch_pause_indexing = false setting.elasticsearch_pause_indexing = false
setting.save! setting.save!
expect(ElasticIndexingControlWorker).to have_enqueued_sidekiq_job
end end
end end
......
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
# This cop checks for `expect(worker).to receive(:perform_async)` usage in specs
#
# @example
# # bad
# it "enqueues a worker" do
# expect(MyWorker).to receive(:perform_async)
# end
#
# # good
# it "enqueues a worker" do
# expect(MyWorker).to have_enqueued_sidekiq_job
# end
#
# # bad
# it "enqueues a worker" do
# expect(MyWorker).to receive(:perform_async).with(1, 2)
# end
#
# # good
# it "enqueues a worker" do
# expect(MyWorker).to have_enqueued_sidekiq_job(1, 2)
# end
#
class HaveEnqueuedSidekiqJob < RuboCop::Cop::Cop
MESSAGE = 'Do not use `receive(:perform_async)` to check a job has been enqueued, use `have_enqueued_sidekiq_job` instead.'
def_node_search :expect_to_receive_perform_async?, <<~PATTERN
(send
(send nil? :expect ...)
{:to :not_to :to_not}
{
(send nil? :receive (sym :perform_async))
(send
(send nil? :receive (sym :perform_async)) ...
)
(send
(send
(send nil? :receive (sym :perform_async)) ...
) ...
)
}
)
PATTERN
def on_send(node)
return unless expect_to_receive_perform_async?(node)
add_offense(node, location: :expression, message: MESSAGE)
end
end
end
end
end
...@@ -658,7 +658,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do ...@@ -658,7 +658,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do
let(:config) { { script: 'deploy', when: 'delayed' } } let(:config) { { script: 'deploy', when: 'delayed' } }
it 'is a delayed' do it 'is a delayed' do
expect(entry.delayed?).to be_truthy expect(entry).to be_delayed
end end
end end
...@@ -666,7 +666,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do ...@@ -666,7 +666,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do
let(:config) { { script: 'deploy' } } let(:config) { { script: 'deploy' } }
it 'is not a delayed' do it 'is not a delayed' do
expect(entry.delayed?).to be_falsey expect(entry).not_to be_delayed
end end
end end
end end
......
...@@ -69,15 +69,15 @@ RSpec.describe Gitlab::Database::PostgresIndex do ...@@ -69,15 +69,15 @@ RSpec.describe Gitlab::Database::PostgresIndex do
describe '#unique?' do describe '#unique?' do
it 'returns true for a unique index' do it 'returns true for a unique index' do
expect(find('public.bar_key').unique?).to be_truthy expect(find('public.bar_key')).to be_unique
end end
it 'returns false for a regular, non-unique index' do it 'returns false for a regular, non-unique index' do
expect(find('public.foo_idx').unique?).to be_falsey expect(find('public.foo_idx')).not_to be_unique
end end
it 'returns true for a primary key index' do it 'returns true for a primary key index' do
expect(find('public.example_table_pkey').unique?).to be_truthy expect(find('public.example_table_pkey')).to be_unique
end end
end end
......
...@@ -1870,7 +1870,7 @@ RSpec.describe Ci::Build do ...@@ -1870,7 +1870,7 @@ RSpec.describe Ci::Build do
end end
describe '#retryable?' do describe '#retryable?' do
subject { build.retryable? } subject { build }
context 'when build is retryable' do context 'when build is retryable' do
context 'when build is successful' do context 'when build is successful' do
...@@ -1878,7 +1878,7 @@ RSpec.describe Ci::Build do ...@@ -1878,7 +1878,7 @@ RSpec.describe Ci::Build do
build.success! build.success!
end end
it { is_expected.to be_truthy } it { is_expected.to be_retryable }
end end
context 'when build is failed' do context 'when build is failed' do
...@@ -1886,7 +1886,7 @@ RSpec.describe Ci::Build do ...@@ -1886,7 +1886,7 @@ RSpec.describe Ci::Build do
build.drop! build.drop!
end end
it { is_expected.to be_truthy } it { is_expected.to be_retryable }
end end
context 'when build is canceled' do context 'when build is canceled' do
...@@ -1894,7 +1894,7 @@ RSpec.describe Ci::Build do ...@@ -1894,7 +1894,7 @@ RSpec.describe Ci::Build do
build.cancel! build.cancel!
end end
it { is_expected.to be_truthy } it { is_expected.to be_retryable }
end end
end end
...@@ -1904,7 +1904,7 @@ RSpec.describe Ci::Build do ...@@ -1904,7 +1904,7 @@ RSpec.describe Ci::Build do
build.run! build.run!
end end
it { is_expected.to be_falsey } it { is_expected.not_to be_retryable }
end end
context 'when build is skipped' do context 'when build is skipped' do
...@@ -1912,7 +1912,7 @@ RSpec.describe Ci::Build do ...@@ -1912,7 +1912,7 @@ RSpec.describe Ci::Build do
build.skip! build.skip!
end end
it { is_expected.to be_falsey } it { is_expected.not_to be_retryable }
end end
context 'when build is degenerated' do context 'when build is degenerated' do
...@@ -1920,7 +1920,7 @@ RSpec.describe Ci::Build do ...@@ -1920,7 +1920,7 @@ RSpec.describe Ci::Build do
build.degenerate! build.degenerate!
end end
it { is_expected.to be_falsey } it { is_expected.not_to be_retryable }
end end
context 'when a canceled build has been retried already' do context 'when a canceled build has been retried already' do
...@@ -1931,7 +1931,7 @@ RSpec.describe Ci::Build do ...@@ -1931,7 +1931,7 @@ RSpec.describe Ci::Build do
end end
context 'when prevent_retry_of_retried_jobs feature flag is enabled' do context 'when prevent_retry_of_retried_jobs feature flag is enabled' do
it { is_expected.to be_falsey } it { is_expected.not_to be_retryable }
end end
context 'when prevent_retry_of_retried_jobs feature flag is disabled' do context 'when prevent_retry_of_retried_jobs feature flag is disabled' do
...@@ -1939,7 +1939,7 @@ RSpec.describe Ci::Build do ...@@ -1939,7 +1939,7 @@ RSpec.describe Ci::Build do
stub_feature_flags(prevent_retry_of_retried_jobs: false) stub_feature_flags(prevent_retry_of_retried_jobs: false)
end end
it { is_expected.to be_truthy } it { is_expected.to be_retryable }
end end
end end
end end
......
# frozen_string_literal: true
require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/rspec/have_enqueued_sidekiq_job'
RSpec.describe RuboCop::Cop::RSpec::HaveEnqueuedSidekiqJob do
let(:source_file) { 'spec/foo_spec.rb' }
subject(:cop) { described_class.new }
shared_examples 'cop' do |good:, bad:|
context "using #{bad} call" do
it 'registers an offense', :aggregate_failures do
expect_offense(<<~CODE, node: bad)
%{node}
^{node} Do not use `receive(:perform_async)` to check a job has been enqueued, use `have_enqueued_sidekiq_job` instead.
CODE
end
end
context "using #{good} call" do
it 'does not register an offense' do
expect_no_offenses(good)
end
end
end
it_behaves_like 'cop',
bad: 'expect(Worker).to receive(:perform_async)',
good: 'expect(Worker).to have_enqueued_sidekiq_job'
include_examples 'cop',
bad: 'expect(Worker).not_to receive(:perform_async)',
good: 'expect(Worker).not_to have_enqueued_sidekiq_job'
include_examples 'cop',
bad: 'expect(Worker).to_not receive(:perform_async)',
good: 'expect(Worker).to_not have_enqueued_sidekiq_job'
include_examples 'cop',
bad: 'expect(Worker).to receive(:perform_async).with(1)',
good: 'expect(Worker).to have_enqueued_sidekiq_job(1)'
include_examples 'cop',
bad: 'expect(Worker).to receive(:perform_async).with(1).once',
good: 'expect(Worker).to have_enqueued_sidekiq_job(1)'
include_examples 'cop',
bad: 'expect(any_variable_or_method).to receive(:perform_async).with(1)',
good: 'expect(any_variable_or_method).to have_enqueued_sidekiq_job(1)'
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment