Commit bb59ec6f authored by Corinna Wiesner's avatar Corinna Wiesner

Address review comments

parent 9e0da6ac
---
title: Add recursive approach to Namespace#all_projects
merge_request: 44740
author:
type: changed
......@@ -46,15 +46,15 @@ RSpec.describe UpdateBuildMinutesService do
end
end
context 'when namespace is subgroup' do
context 'when group is subgroup' do
let(:root_ancestor) { create(:group, shared_runners_minutes_limit: 100) }
let(:namespace) { create(:namespace, parent: root_ancestor) }
let(:namespace) { create(:group, parent: root_ancestor) }
it 'creates a statistics in root namespace' do
it 'creates a statistics in root group' do
subject
expect(root_ancestor.namespace_statistics&.shared_runners_seconds)
.to be_nil
expect(root_ancestor.namespace_statistics.reload.shared_runners_seconds)
.to eq(build.duration.to_i * 2)
end
context 'with disabled feature flag :recursive_approach_for_all_projects in Namespace#all_projects' do
......@@ -62,7 +62,7 @@ RSpec.describe UpdateBuildMinutesService do
stub_feature_flags(recursive_approach_for_all_projects: false)
end
it 'creates a statistics in root namespace' do
it 'creates a statistics in root group' do
subject
expect(root_ancestor.namespace_statistics.reload.shared_runners_seconds)
......
......@@ -856,10 +856,10 @@ RSpec.describe Namespace do
describe '#all_projects' do
shared_examples 'all projects for a namespace' do
let(:group) { create(:group) }
let(:child) { create(:group, parent: group) }
let!(:project1) { create(:project_empty_repo, namespace: group) }
let!(:project2) { create(:project_empty_repo, namespace: child) }
let_it_be(:group) { create(:group) }
let_it_be(:child) { create(:group, parent: group) }
let_it_be(:project1) { create(:project_empty_repo, namespace: group) }
let_it_be(:project2) { create(:project_empty_repo, namespace: child) }
it { expect(group.all_projects.to_a).to match_array([project2, project1]) }
it { expect(child.all_projects.to_a).to match_array([project2]) }
......
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