gitlab-org--gitlab-foss/spec/controllers/projects/builds_controller_spec.rb

38 lines
1 KiB
Ruby
Raw Normal View History

2017-03-06 07:01:18 -05:00
require 'spec_helper'
describe Projects::BuildsController do
include ApiHelpers
let(:user) { create(:user) }
let(:project) { create(:empty_project, :public) }
before do
sign_in(user)
end
describe 'GET status.json' do
context 'when accessing status' do
2017-03-10 12:44:41 -05:00
let(:status) do
Gitlab::Ci::Status::Success.new(double('object'), double('user'))
end
2017-03-06 07:01:18 -05:00
before do
pipeline = create(:ci_pipeline, project: project)
2017-03-10 12:44:41 -05:00
build = create(:ci_build, pipeline: pipeline, status: :success)
2017-03-06 07:01:18 -05:00
get :status, namespace_id: project.namespace,
2017-03-06 10:42:39 -05:00
project_id: project,
id: build.id,
format: :json
2017-03-06 07:01:18 -05:00
end
it 'return a correct pipeline status' do
2017-03-06 07:01:18 -05:00
expect(response).to have_http_status(:ok)
2017-03-11 09:30:25 -05:00
expect(json_response['text']).to eq status.text
expect(json_response['label']).to eq status.label
expect(json_response['icon']).to eq status.icon
2017-03-10 12:44:41 -05:00
expect(json_response['favicon']).to eq status.favicon
2017-03-06 07:01:18 -05:00
end
end
end
end