Commit 38b1ec2c authored by Shinya Maeda's avatar Shinya Maeda

Fix rspec failure

parent ea08e2c8
......@@ -76,8 +76,7 @@ class Projects::BuildsController < Projects::ApplicationController
def status
render json: BuildSerializer
.new(project: @project, user: @current_user)
.only_status
.represent(@build)
.represent_status(@build)
end
def erase
......
......@@ -476,8 +476,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def status
render json: PipelineSerializer
.new(project: @project, user: @current_user)
.only_status
.represent(@merge_request.head_pipeline)
.represent_status(@merge_request.head_pipeline)
end
def ci_environments_status
......
......@@ -75,8 +75,7 @@ class Projects::PipelinesController < Projects::ApplicationController
def status
render json: PipelineSerializer
.new(project: @project, user: @current_user)
.only_status
.represent(@pipeline)
.represent_status(@pipeline)
end
def stage
......
......@@ -12,9 +12,13 @@ describe Projects::BuildsController do
describe 'GET status.json' do
context 'when accessing status' do
let(:status) do
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
end
before do
pipeline = create(:ci_pipeline, project: project)
build = create(:ci_build, pipeline: pipeline, status: 'success')
build = create(:ci_build, pipeline: pipeline, status: :success)
get :status, namespace_id: project.namespace,
project_id: project,
id: build.id,
......@@ -23,7 +27,7 @@ describe Projects::BuildsController do
it 'return a correct pipeline status' do
expect(response).to have_http_status(:ok)
expect(json_response['details']['status']['text']).to eq 'passed'
expect(json_response['favicon']).to eq status.favicon
end
end
end
......
......@@ -1181,11 +1181,15 @@ describe Projects::MergeRequestsController do
describe 'GET status.json' do
context 'when accessing status' do
let(:status) do
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
end
before do
create(:ci_pipeline, project: merge_request.source_project,
ref: merge_request.source_branch,
sha: merge_request.diff_head_sha,
status: 'success')
status: :success)
get :status, namespace_id: project.namespace,
project_id: project,
id: merge_request.iid,
......@@ -1194,7 +1198,7 @@ describe Projects::MergeRequestsController do
it 'return a correct pipeline status' do
expect(response).to have_http_status(:ok)
expect(json_response['details']['status']['text']).to eq 'passed'
expect(json_response['favicon']).to eq status.favicon
end
end
end
......
......@@ -72,8 +72,12 @@ describe Projects::PipelinesController do
describe 'GET status.json' do
context 'when accessing status' do
let(:status) do
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
end
before do
pipeline = create(:ci_pipeline, project: project, status: 'success')
pipeline = create(:ci_pipeline, project: project, status: :success)
get :status, namespace_id: project.namespace,
project_id: project,
id: pipeline.id,
......@@ -82,7 +86,7 @@ describe Projects::PipelinesController do
it 'return a correct pipeline status' do
expect(response).to have_http_status(:ok)
expect(json_response['details']['status']['text']).to eq 'passed'
expect(json_response['favicon']).to eq status.favicon
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