Update tests and associations

This commit is contained in:
Kamil Trzcinski 2017-04-06 15:14:40 +02:00
parent b828a98c1c
commit 62919a17e1
No known key found for this signature in database
GPG key ID: 4505F5C7E12C6A5A
2 changed files with 12 additions and 4 deletions

View file

@ -13,15 +13,16 @@ class PipelineSerializer < BaseSerializer
def represent(resource, opts = {})
if resource.is_a?(ActiveRecord::Relation)
resource = resource.includes(:project)
resource = resource.includes(:pending_builds,
:retryable_builds,
:cancelable_statuses,
:manual_actions,
:artifacts)
:artifacts,
:trigger_requests)
resource = resource.includes(pending_builds: :project)
resource = resource.includes(manual_actions: :project)
resource = resource.includes(artifacts: :project)
resource = resource.includes(project: :namespace)
resource = resource.includes(manual_actions: { project: :namespace })
resource = resource.includes(artifacts: { project: :namespace })
end
if paginated?

View file

@ -101,6 +101,13 @@ describe PipelineSerializer do
Ci::Pipeline::AVAILABLE_STATUSES.each do |status|
create_pipeline(status)
end
RequestStore.begin!
end
after do
RequestStore.end!
RequestStore.clear!
end
it "verifies number of queries" do