Update tests and associations
This commit is contained in:
parent
b828a98c1c
commit
62919a17e1
2 changed files with 12 additions and 4 deletions
|
@ -13,15 +13,16 @@ class PipelineSerializer < BaseSerializer
|
||||||
|
|
||||||
def represent(resource, opts = {})
|
def represent(resource, opts = {})
|
||||||
if resource.is_a?(ActiveRecord::Relation)
|
if resource.is_a?(ActiveRecord::Relation)
|
||||||
resource = resource.includes(:project)
|
|
||||||
resource = resource.includes(:pending_builds,
|
resource = resource.includes(:pending_builds,
|
||||||
:retryable_builds,
|
:retryable_builds,
|
||||||
:cancelable_statuses,
|
:cancelable_statuses,
|
||||||
:manual_actions,
|
:manual_actions,
|
||||||
:artifacts)
|
:artifacts,
|
||||||
|
:trigger_requests)
|
||||||
resource = resource.includes(pending_builds: :project)
|
resource = resource.includes(pending_builds: :project)
|
||||||
resource = resource.includes(manual_actions: :project)
|
resource = resource.includes(project: :namespace)
|
||||||
resource = resource.includes(artifacts: :project)
|
resource = resource.includes(manual_actions: { project: :namespace })
|
||||||
|
resource = resource.includes(artifacts: { project: :namespace })
|
||||||
end
|
end
|
||||||
|
|
||||||
if paginated?
|
if paginated?
|
||||||
|
|
|
@ -101,6 +101,13 @@ describe PipelineSerializer do
|
||||||
Ci::Pipeline::AVAILABLE_STATUSES.each do |status|
|
Ci::Pipeline::AVAILABLE_STATUSES.each do |status|
|
||||||
create_pipeline(status)
|
create_pipeline(status)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
RequestStore.begin!
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
RequestStore.end!
|
||||||
|
RequestStore.clear!
|
||||||
end
|
end
|
||||||
|
|
||||||
it "verifies number of queries" do
|
it "verifies number of queries" do
|
||||||
|
|
Loading…
Reference in a new issue