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

Rename method to more detailed name

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