Commit 2b33e9ee authored by Shinya Maeda's avatar Shinya Maeda

with_status to only_status

parent 170e5423
...@@ -76,7 +76,7 @@ class Projects::BuildsController < Projects::ApplicationController ...@@ -76,7 +76,7 @@ class Projects::BuildsController < Projects::ApplicationController
def status def status
render json: BuildSerializer render json: BuildSerializer
.new(project: @project, user: @current_user) .new(project: @project, user: @current_user)
.with_status .only_status
.represent(@build) .represent(@build)
end end
......
...@@ -476,7 +476,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -476,7 +476,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def status def status
render json: PipelineSerializer render json: PipelineSerializer
.new(project: @project, user: @current_user) .new(project: @project, user: @current_user)
.with_status .only_status
.represent(@merge_request.head_pipeline) .represent(@merge_request.head_pipeline)
end end
......
...@@ -75,7 +75,7 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -75,7 +75,7 @@ class Projects::PipelinesController < Projects::ApplicationController
def status def status
render json: PipelineSerializer render json: PipelineSerializer
.new(project: @project, user: @current_user) .new(project: @project, user: @current_user)
.with_status .only_status
.represent(@pipeline) .represent(@pipeline)
end end
......
class BuildSerializer < BaseSerializer class BuildSerializer < BaseSerializer
entity BuildEntity entity BuildEntity
def with_status def only_status
tap { @status_only = { only: [{ details: [:status] }] } } tap { @status_only = { only: [{ details: [:status] }] } }
end end
......
...@@ -11,7 +11,7 @@ class PipelineSerializer < BaseSerializer ...@@ -11,7 +11,7 @@ class PipelineSerializer < BaseSerializer
@paginator.present? @paginator.present?
end end
def with_status def only_status
tap { @status_only = { only: [{ details: [:status] }] } } tap { @status_only = { only: [{ details: [:status] }] } }
end end
......
...@@ -13,7 +13,7 @@ describe BuildSerializer do ...@@ -13,7 +13,7 @@ describe BuildSerializer do
context 'when used with status' do context 'when used with status' do
let(:serializer) do let(:serializer) do
described_class.new(user: user) described_class.new(user: user)
.with_status .only_status
end end
let(:resource) { create(:ci_build) } let(:resource) { create(:ci_build) }
......
...@@ -97,7 +97,7 @@ describe PipelineSerializer do ...@@ -97,7 +97,7 @@ describe PipelineSerializer do
context 'when used with status' do context 'when used with status' do
let(:serializer) do let(:serializer) do
described_class.new(user: user) described_class.new(user: user)
.with_status .only_status
end end
let(:resource) { create(:ci_empty_pipeline) } let(:resource) { create(:ci_empty_pipeline) }
......
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