gitlab-org--gitlab-foss/spec/frontend/fixtures/jobs.rb

57 lines
1.6 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
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) }
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')
2018-10-26 04:48:20 -04:00
end
render_views
before(:all) do
clean_frontend_fixtures('builds/')
2018-10-26 04:48:20 -04:00
clean_frontend_fixtures('jobs/')
end
before do
sign_in(admin)
end
after do
remove_repository(project)
end
it 'builds/build-with-artifacts.html' do
get :show, params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: build_with_artifacts.to_param
}
expect(response).to be_successful
end
2018-10-26 04:48:20 -04:00
it 'jobs/delayed.json' do
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
expect(response).to be_successful
2018-10-26 04:48:20 -04:00
end
end