Skip to content
Snippets Groups Projects
Commit ed23a527 authored by Vitali Tatarintev's avatar Vitali Tatarintev
Browse files

Fix RSpec/BeEmpty offenses

Fix RSpec/BeEmpty Rubocop offenses
parent 9c877f95
No related branches found
No related tags found
3 merge requests!181325Fix ambiguous `created_at` in project.rb,!180187Draft: Update dashboard editing to save visualizations directly to the dashboard file,!179209Fix RSpec/BeEmpty offenses
Showing
with 33 additions and 55 deletions
---
# Cop supports --autocorrect.
RSpec/BeEmpty:
Exclude:
- 'ee/spec/models/concerns/elastic/application_versioned_search_spec.rb'
- 'ee/spec/models/ee/group_spec.rb'
- 'ee/spec/models/ee/user_spec.rb'
- 'ee/spec/models/product_analytics/visualization_spec.rb'
- 'ee/spec/requests/api/graphql/ai/feature_settings/feature_settings_spec.rb'
- 'ee/spec/services/releases/update_service_spec.rb'
- 'ee/spec/support/shared_examples/lib/sidebars/menus_shared_examples.rb'
- 'ee/spec/support/shared_examples/models/authz/member_roles_shared_examples.rb'
- 'ee/spec/support/shared_examples/quick_actions/merge_request/unassign_reviewer_shared_examples.rb'
- 'spec/helpers/nav/new_dropdown_helper_spec.rb'
- 'spec/helpers/users_helper_spec.rb'
- 'spec/lib/click_house/iterator_spec.rb'
- 'spec/lib/gitlab/checks/changes_access_spec.rb'
- 'spec/lib/gitlab/ci/jwt_spec.rb'
- 'spec/lib/gitlab/ci/variables/builder/release_spec.rb'
- 'spec/lib/gitlab/mail_room/mail_room_spec.rb'
- 'spec/lib/gitlab/search_results_spec.rb'
- 'spec/lib/search/empty_search_results_spec.rb'
......@@ -58,14 +58,14 @@ def self.name
describe '.associations_needing_elasticsearch_update' do
context 'when elastic_index_dependents is empty' do
it 'returns an empty array' do
expect(klass.new.associations_needing_elasticsearch_update(['title'])).to match_array []
expect(klass.new.associations_needing_elasticsearch_update(['title'])).to be_empty
end
end
context 'when updated_attributes does not contains on_change attribute' do
it 'returns an empty array' do
klass.elastic_index_dependant_association :widgets, on_change: :name
expect(klass.new.associations_needing_elasticsearch_update(['title'])).to match_array []
expect(klass.new.associations_needing_elasticsearch_update(['title'])).to be_empty
end
end
......@@ -81,7 +81,7 @@ def self.name
last_migration = Elastic::DataMigrationService.migrations.last.name_for_key.to_sym
klass.elastic_index_dependant_association :widgets, on_change: :title, depends_on_finished_migration: last_migration
set_elasticsearch_migration_to last_migration, including: false
expect(klass.new.associations_needing_elasticsearch_update([:title])).to match_array []
expect(klass.new.associations_needing_elasticsearch_update([:title])).to be_empty
end
end
......
......@@ -1787,7 +1787,7 @@
shared_examples 'returns empty array' do
it do
expect(group.billed_shared_group_members(exclude_guests: true)).to match_array([])
expect(group.billed_shared_group_members(exclude_guests: true)).to be_empty
end
end
......
......@@ -391,7 +391,7 @@
subject(:with_saml_provider) { described_class.with_saml_provider(saml_provider) }
it 'does not find users without a SAML identity' do
expect(with_saml_provider).to match_array([])
expect(with_saml_provider).to be_empty
end
context 'when users have a SAML identity tied to the provider' do
......@@ -404,7 +404,7 @@
it 'does not find users with a different SAML provider' do
provider = create(:saml_provider)
expect(described_class.with_saml_provider(provider)).to match_array([])
expect(described_class.with_saml_provider(provider)).to be_empty
end
end
end
......@@ -452,7 +452,7 @@
subject(:with_provisioning_group) { described_class.with_provisioning_group(group) }
it 'does not find users without a provisioning group' do
expect(with_provisioning_group).to match_array([])
expect(with_provisioning_group).to be_empty
end
context 'when users have a provisioning group' do
......@@ -468,7 +468,7 @@
it 'does not find users with a different SAML provider' do
group = create(:group)
expect(described_class.with_provisioning_group(group)).to match_array([])
expect(described_class.with_provisioning_group(group)).to be_empty
end
end
end
......@@ -1053,7 +1053,7 @@
subject(:available_subgroups) { user.available_subgroups_with_custom_project_templates }
it 'does not return any templates' do
expect(available_subgroups).to match_array([])
expect(available_subgroups).to be_empty
end
context 'when feature flag "project_templates_without_min_access" is disabled' do
......@@ -2260,7 +2260,7 @@
end
it 'returns empty array if there are user is not have access of reporter or above' do
expect(user.zoekt_indexed_namespaces).to match_array([])
expect(user.zoekt_indexed_namespaces).to be_empty
end
end
......
......@@ -160,7 +160,7 @@
end
it 'does not include built in visualizations for VSD' do
expect(subject.map(&:slug)).to match_array([])
expect(subject.map(&:slug)).to be_empty
end
end
......
......@@ -140,7 +140,7 @@
it 'returns the expected response' do
post_graphql(query, current_user: current_user)
expect(ai_feature_settings_data).to match_array([])
expect(ai_feature_settings_data).to be_empty
end
end
end
......
......@@ -89,7 +89,7 @@
result = service.execute
release.reload
expect(release.milestones).to match_array([])
expect(release.milestones).to be_empty
expect(result[:milestones_updated]).to be_truthy
end
end
......@@ -104,7 +104,7 @@
service.execute
release.reload
expect(release.milestones).to match_array([])
expect(release.milestones).to be_empty
end
end
end
......
......@@ -14,6 +14,6 @@
.select { |item| item.is_a?(::Sidebars::NilMenuItem) }
.map(&:item_id)
expect(nil_items).to match_array([])
expect(nil_items).to be_empty
end
end
......@@ -88,7 +88,7 @@
end
it 'returns empty array' do
expect(result[source.id]).to match_array([])
expect(result[source.id]).to be_empty
end
end
......@@ -98,7 +98,7 @@
end
it 'returns empty array' do
expect(result[source.id]).to match_array([])
expect(result[source.id]).to be_empty
end
end
end
......@@ -116,7 +116,7 @@
end
it 'returns empty array' do
expect(result[source.id]).to match_array([])
expect(result[source.id]).to be_empty
end
end
end
......@@ -182,7 +182,7 @@
end
it 'returns empty array' do
expect(result[source.id]).to match_array([])
expect(result[source.id]).to be_empty
end
end
end
......@@ -200,7 +200,7 @@
end
it 'returns empty array' do
expect(result[source.id]).to match_array([])
expect(result[source.id]).to be_empty
end
end
end
......
......@@ -10,7 +10,7 @@
expected_message = example[:multiline] ? "Removed reviewer @#{reviewer.username}. Removed reviewer @#{user.username}." : "Removed reviewers @#{user.username} and @#{reviewer.username}."
expect(update_params[:reviewer_ids]).to match_array([])
expect(update_params[:reviewer_ids]).to be_empty
expect(message).to eq(expected_message)
expect { service.apply_updates(update_params, note) }.not_to raise_error
end
......
......@@ -166,7 +166,7 @@
end
it 'does not have new organization menu item' do
expect(view_model[:menu_sections]).to match_array([])
expect(view_model[:menu_sections]).to be_empty
end
end
......@@ -176,7 +176,7 @@
end
it 'does not have new organization menu item' do
expect(view_model[:menu_sections]).to match_array([])
expect(view_model[:menu_sections]).to be_empty
end
end
end
......
......@@ -111,7 +111,7 @@ def filter_ee_badges(badges)
end
it 'is empty' do
expect(profile_actions).to match_array []
expect(profile_actions).to be_empty
end
end
......
......@@ -88,7 +88,7 @@ def collect_ids_with_batch_size(of)
end
it 'returns no data' do
expect(collect_ids_with_batch_size(3)).to match_array([])
expect(collect_ids_with_batch_size(3)).to be_empty
end
end
end
......@@ -63,7 +63,7 @@
it 'calls #new_commits' do
expect(project.repository).to receive(:new_commits).and_call_original
expect(subject.commits).to match_array([])
expect(subject.commits).to be_empty
end
context 'when change is for notes ref' do
......@@ -72,7 +72,7 @@
end
it 'does not return any commits' do
expect(subject.commits).to match_array([])
expect(subject.commits).to be_empty
end
end
......
......@@ -34,7 +34,7 @@
it 'has correct values for the custom attributes' do
aggregate_failures do
expect(payload[:groups_direct]).to match_array([])
expect(payload[:groups_direct]).to be_empty
expect(payload[:namespace_id]).to eq(namespace.id.to_s)
expect(payload[:namespace_path]).to eq(namespace.full_path)
expect(payload[:project_id]).to eq(project.id.to_s)
......
......@@ -48,7 +48,7 @@
it 'returns without error' do
builder = subject
expect(builder).to match_array([])
expect(builder.to_a).to be_empty
expect(builder.errors).to be_nil
end
end
......
......@@ -163,7 +163,7 @@
let(:custom_config) { { enabled: false } }
it 'returns an empty array' do
expect(described_class.enabled_mailbox_types).to match_array([])
expect(described_class.enabled_mailbox_types).to be_empty
end
end
end
......
......@@ -104,7 +104,7 @@
with_them do
it 'returns an empty array' do
expect(results.aggregations(scope)).to match_array([])
expect(results.aggregations(scope)).to be_empty
end
end
end
......
......@@ -7,7 +7,7 @@
describe '#objects' do
it 'returns an empty array' do
expect(results.objects).to match_array([])
expect(results.objects).to be_empty
end
end
......@@ -37,7 +37,7 @@
describe '#aggregations' do
it 'returns an empty array' do
expect(results.aggregations).to match_array([])
expect(results.aggregations).to be_empty
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment