Commit 751b0df1 authored by huzaifaiftikhar1's avatar huzaifaiftikhar1

Use local variables instead of using let_it_be

parent a9edd65c
......@@ -41,11 +41,9 @@ module EE
finder_params = { aimed_for_deletion: true }
unless current_user.can_admin_all_resources?
# only list projects with at least owner access if the user is not an admin
finder_params[:min_access_level] = ::Gitlab::Access::OWNER
if ::Gitlab::CurrentSettings.should_check_namespace_plan?
# only list projects that have delayed deletion feature available
finder_params[:feature_available] = :adjourned_deletion_for_projects_and_groups
end
end
......
......@@ -446,16 +446,16 @@ RSpec.describe Project do
end
describe '.with_feature_available', :saas do
let_it_be(:user) { create(:user) }
let_it_be(:ultimate_group) { create(:group_with_plan, plan: :ultimate_plan) }
let_it_be(:premium_group) { create(:group_with_plan, plan: :premium_plan) }
let_it_be(:no_plan_group) { create(:group_with_plan, plan: nil) }
let_it_be(:ultimate_project) { create(:project, :archived, creator: user, namespace: ultimate_group) }
let_it_be(:premium_project) { create(:project, :archived, creator: user, namespace: premium_group) }
let_it_be(:no_plan_project) { create(:project, :archived, creator: user, namespace: no_plan_group) }
let_it_be(:no_plan_public_project) { create(:project, :archived, creator: user, visibility: ::Gitlab::VisibilityLevel::PUBLIC, namespace: no_plan_group) }
it 'lists projects with the feature available' do
user = create(:user)
ultimate_group = create(:group_with_plan, plan: :ultimate_plan)
premium_group = create(:group_with_plan, plan: :premium_plan)
no_plan_group = create(:group_with_plan, plan: nil)
ultimate_project = create(:project, :archived, creator: user, namespace: ultimate_group)
premium_project = create(:project, :archived, creator: user, namespace: premium_group)
no_plan_project = create(:project, :archived, creator: user, namespace: no_plan_group)
no_plan_public_project = create(:project, :archived, creator: user, visibility: ::Gitlab::VisibilityLevel::PUBLIC, namespace: no_plan_group)
expect(described_class.with_feature_available(:adjourned_deletion_for_projects_and_groups)).to contain_exactly(premium_project, ultimate_project, no_plan_public_project)
expect(described_class.with_feature_available(:adjourned_deletion_for_projects_and_groups)).not_to include(no_plan_project)
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