Commit 7ec7c57a authored by Arturo Herrero's avatar Arturo Herrero

Fix RuboCop offenses

- Remove redundant self
- Use do...end for multi-line blocks
- No space between ->(parameter)
- Move EE spec under EE namespace directory
- Use update! instead of update
- Use .and_return
parent f6c065c0
......@@ -72,7 +72,7 @@ module EE
validate :custom_project_templates_group_allowed, if: :custom_project_templates_group_id_changed?
scope :aimed_for_deletion, -> (date) { joins(:deletion_schedule).where('group_deletion_schedules.marked_for_deletion_on <= ?', date) }
scope :aimed_for_deletion, ->(date) { joins(:deletion_schedule).where('group_deletion_schedules.marked_for_deletion_on <= ?', date) }
scope :with_deletion_schedule, -> { preload(deletion_schedule: :deleting_user) }
scope :with_deletion_schedule_only, -> { preload(:deletion_schedule) }
......@@ -80,14 +80,14 @@ module EE
joins(:ldap_group_links).where(ldap_group_links: { provider: provider })
end
scope :with_managed_accounts_enabled, -> {
scope :with_managed_accounts_enabled, -> do
joins(:saml_provider).where(saml_providers:
{
enabled: true,
enforced_sso: true,
enforced_group_managed_accounts: true
})
}
end
scope :with_no_pat_expiry_policy, -> { where(max_personal_access_token_lifetime: nil) }
......@@ -459,7 +459,7 @@ module EE
return unless feature_available?(:group_webhooks)
self_and_ancestor_hooks = GroupHook.where(group_id: self.self_and_ancestors)
self_and_ancestor_hooks = GroupHook.where(group_id: self_and_ancestors)
self_and_ancestor_hooks.hooks_for(hooks_scope).each do |hook|
hook.async_execute(data, hooks_scope.to_s)
end
......
......@@ -170,7 +170,7 @@ RSpec.describe Group do
context 'after the start transition' do
it 'sets the last sync timestamp' do
expect { group.start_ldap_sync }.to change { group.ldap_sync_last_sync_at }
expect { group.start_ldap_sync }.to change(group, :ldap_sync_last_sync_at)
end
end
......@@ -388,7 +388,7 @@ RSpec.describe Group do
let(:group) { build(:group) }
before do
allow_any_instance_of(ApplicationSetting).to receive(:repository_size_limit).and_return(50)
allow_any_instance_of(ApplicationSetting).to receive(:repository_size_limit).and_return(50) # rubocop:disable RSpec/AnyInstanceOf
end
it 'returns the value set globally' do
......@@ -535,7 +535,7 @@ RSpec.describe Group do
let(:push_rule) { create(:push_rule) }
it 'returns its own push rule' do
group.update(push_rule: push_rule)
group.update!(push_rule: push_rule)
expect(group.predefined_push_rule).to eq(push_rule)
end
......@@ -647,7 +647,7 @@ RSpec.describe Group do
context 'when in need of checking plan' do
before do
allow(Gitlab::CurrentSettings.current_application_settings)
.to receive(:should_check_namespace_plan?) { true }
.to receive(:should_check_namespace_plan?).and_return(true)
end
it 'returns true for groups in proper plan' do
......@@ -918,6 +918,7 @@ RSpec.describe Group do
let_it_be(:group) { create(:group, parent: parent_group) }
let_it_be(:group_hook) { create(:group_hook, group: group, member_events: true) }
let_it_be(:parent_group_hook) { create(:group_hook, group: parent_group, member_events: true) }
let(:data) { { some: 'info' } }
before do
......
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