Commit 63fc2d01 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'improve-code-ee-group' into 'master'

Fix RuboCop offenses of EE group model

See merge request gitlab-org/gitlab!57384
parents e7423716 2bd78c22
......@@ -81,7 +81,6 @@ Rails/SaveBang:
- 'ee/spec/models/geo_node_spec.rb'
- 'ee/spec/models/geo_node_status_spec.rb'
- 'ee/spec/models/gitlab_subscription_spec.rb'
- 'ee/spec/models/group_spec.rb'
- 'ee/spec/models/issue_spec.rb'
- 'ee/spec/models/label_note_spec.rb'
- 'ee/spec/models/lfs_object_spec.rb'
......@@ -711,7 +710,6 @@ RSpec/EmptyLineAfterFinalLetItBe:
- ee/spec/models/geo/lfs_object_registry_spec.rb
- ee/spec/models/gitlab_subscription_spec.rb
- ee/spec/models/group_member_spec.rb
- ee/spec/models/group_spec.rb
- ee/spec/models/instance_security_dashboard_spec.rb
- ee/spec/models/issue_spec.rb
- ee/spec/models/label_note_spec.rb
......@@ -1733,7 +1731,6 @@ RSpec/AnyInstanceOf:
- 'ee/spec/migrations/update_vulnerability_severity_column_spec.rb'
- 'ee/spec/models/ee/namespace_spec.rb'
- 'ee/spec/models/geo_node_status_spec.rb'
- 'ee/spec/models/group_spec.rb'
- 'ee/spec/models/issue_spec.rb'
- 'ee/spec/models/merge_request_spec.rb'
- 'ee/spec/models/project_import_state_spec.rb'
......
......@@ -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(::Gitlab::CurrentSettings).to receive(:repository_size_limit).and_return(50)
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