Commit 7e4649af authored by Andreas Brandl's avatar Andreas Brandl

Rename method to more detailed name

parent d82fab0b
......@@ -418,7 +418,7 @@ module API
options: { only_owned: true }
).execute
Entities::Project.prepare!(projects)
Entities::Project.preload_and_batch_count!(projects)
end
expose :shared_projects, using: Entities::Project do |group, options|
......@@ -428,7 +428,7 @@ module API
options: { only_shared: true }
).execute
Entities::Project.prepare!(projects)
Entities::Project.preload_and_batch_count!(projects)
end
end
......
......@@ -231,7 +231,7 @@ module API
projects, options = with_custom_attributes(projects, options)
present options[:with].prepare!(projects), options
present options[:with].preload_and_batch_count!(projects), options
end
desc 'Get a list of subgroups in this group.' do
......
......@@ -7,7 +7,7 @@ module API
class_methods do
# This adds preloading to the query and executes batch counting
# Side-effect: The query will be executed during batch counting
def prepare!(projects_relation)
def preload_and_batch_count!(projects_relation)
preload_relation(projects_relation).tap do |projects|
execute_batch_counting(projects)
end
......
......@@ -9,7 +9,7 @@ describe API::ProjectsBatchCounting do
end
end
describe '.prepare!' do
describe '.preload_and_batch_count!' do
let(:projects) { double }
let(:preloaded_projects) { double }
......@@ -18,7 +18,7 @@ describe API::ProjectsBatchCounting do
expect(subject).to receive(:preload_relation).with(projects).and_return(preloaded_projects)
expect(subject.prepare!(projects)).to eq(preloaded_projects)
expect(subject.preload_and_batch_count!(projects)).to eq(preloaded_projects)
end
it 'executes batch counting' do
......@@ -26,7 +26,7 @@ describe API::ProjectsBatchCounting do
expect(subject).to receive(:execute_batch_counting).with(preloaded_projects)
subject.prepare!(projects)
subject.preload_and_batch_count!(projects)
end
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