2016-11-18 15:31:11 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-05-16 07:41:15 -04:00
|
|
|
describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
|
2016-11-18 15:31:11 -05:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
let(:admin) { create(:admin) }
|
2016-11-19 18:40:37 -05:00
|
|
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
2018-10-26 04:48:20 -04:00
|
|
|
let(:project) { create(:project, :repository, namespace: namespace, path: 'builds-project') }
|
|
|
|
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) }
|
2018-02-05 04:07:37 -05:00
|
|
|
let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace_artifact, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) }
|
2016-11-18 15:31:11 -05:00
|
|
|
let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') }
|
|
|
|
let!(:pending_build) { create(:ci_build, :pending, pipeline: pipeline, stage: 'deploy') }
|
2018-10-26 04:48:20 -04:00
|
|
|
let!(:delayed_job) do
|
|
|
|
create(:ci_build, :scheduled,
|
|
|
|
pipeline: pipeline,
|
|
|
|
name: 'delayed job',
|
|
|
|
stage: 'test',
|
|
|
|
commands: 'test')
|
|
|
|
end
|
2016-11-18 15:31:11 -05:00
|
|
|
|
|
|
|
render_views
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('builds/')
|
2018-10-26 04:48:20 -04:00
|
|
|
clean_frontend_fixtures('jobs/')
|
2016-11-18 15:31:11 -05:00
|
|
|
end
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2016-11-18 15:31:11 -05:00
|
|
|
sign_in(admin)
|
|
|
|
end
|
|
|
|
|
2017-08-22 19:19:35 -04:00
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
|
|
|
|
2016-11-18 15:31:11 -05:00
|
|
|
it 'builds/build-with-artifacts.html.raw' do |example|
|
|
|
|
get :show,
|
|
|
|
namespace_id: project.namespace.to_param,
|
2017-02-23 18:55:01 -05:00
|
|
|
project_id: project,
|
2016-11-18 15:31:11 -05:00
|
|
|
id: build_with_artifacts.to_param
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, example.description)
|
|
|
|
end
|
2018-10-26 04:48:20 -04:00
|
|
|
|
|
|
|
it 'jobs/delayed.json' do |example|
|
|
|
|
get :show,
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project,
|
|
|
|
id: delayed_job.to_param,
|
|
|
|
format: :json
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
store_frontend_fixture(response, example.description)
|
|
|
|
end
|
2016-11-18 15:31:11 -05:00
|
|
|
end
|