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

Fix rspec failure

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