2019-10-17 02:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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',
|
2018-09-02 10:35:15 -04:00
|
|
|
stage: 'test')
|
2018-10-26 04:48:20 -04:00
|
|
|
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
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'builds/build-with-artifacts.html' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :show, params: {
|
2016-11-18 15:31:11 -05:00
|
|
|
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
|
2018-12-19 14:50:20 -05:00
|
|
|
}
|
2016-11-18 15:31:11 -05:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2016-11-18 15:31:11 -05:00
|
|
|
end
|
2018-10-26 04:48:20 -04:00
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'jobs/delayed.json' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :show, params: {
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project,
|
|
|
|
id: delayed_job.to_param
|
|
|
|
}, format: :json
|
2018-10-26 04:48:20 -04:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2018-10-26 04:48:20 -04:00
|
|
|
end
|
2016-11-18 15:31:11 -05:00
|
|
|
end
|