2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'projects/jobs/show' do
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline) }
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:builds) { project.builds.present(current_user: user) }
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
let(:pipeline) do
|
2017-08-17 22:00:37 +05:30
|
|
|
create(:ci_pipeline, project: project, sha: project.commit.id)
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:project, project)
|
2018-05-09 12:01:36 +05:30
|
|
|
assign(:builds, builds)
|
2016-08-24 12:49:21 +05:30
|
|
|
|
|
|
|
allow(view).to receive(:can?).and_return(true)
|
|
|
|
end
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
context 'when showing a CI build' do
|
2016-08-24 12:49:21 +05:30
|
|
|
before do
|
2022-01-26 12:08:38 +05:30
|
|
|
assign(:build, build.present)
|
2016-08-24 12:49:21 +05:30
|
|
|
render
|
|
|
|
end
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
it 'shows job vue app' do
|
|
|
|
expect(rendered).to have_css('#js-job-page')
|
|
|
|
expect(rendered).not_to have_css('#js-bridge-page')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when job is running' do
|
|
|
|
let(:build) { create(:ci_build, :trace_live, :running, pipeline: pipeline) }
|
|
|
|
|
|
|
|
it 'does not show retry button' do
|
|
|
|
expect(rendered).not_to have_link('Retry')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show New issue button' do
|
|
|
|
expect(rendered).not_to have_link('New issue')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when showing a bridge job' do
|
|
|
|
let(:bridge) { create(:ci_bridge, status: :pending) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
assign(:build, bridge)
|
|
|
|
render
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
it 'shows bridge vue app' do
|
|
|
|
expect(rendered).to have_css('#js-bridge-page')
|
|
|
|
expect(rendered).not_to have_css('#js-job-page')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|