2019-10-08 08:06:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-10 10:00:23 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe 'projects/ci/jobs/_build' do
|
2016-11-10 10:00:23 -05:00
|
|
|
include Devise::Test::ControllerHelpers
|
|
|
|
|
2017-03-27 16:20:27 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
2019-06-14 09:17:18 -04:00
|
|
|
let(:pipeline) { create(:ci_empty_pipeline, id: 1337, project: project, sha: project.commit.id) }
|
2016-11-10 10:00:23 -05:00
|
|
|
let(:build) { create(:ci_build, pipeline: pipeline, stage: 'test', stage_idx: 1, name: 'rspec 0:2', status: :pending) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
controller.prepend_view_path('app/views/projects')
|
|
|
|
allow(view).to receive(:can?).and_return(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'won\'t include a column with a link to its pipeline by default' do
|
|
|
|
render partial: 'projects/ci/builds/build', locals: { build: build }
|
|
|
|
|
2019-06-14 09:17:18 -04:00
|
|
|
expect(rendered).not_to have_link('#1337')
|
|
|
|
expect(rendered).not_to have_text('#1337 by API')
|
2016-11-10 10:00:23 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'can include a column with a link to its pipeline' do
|
|
|
|
render partial: 'projects/ci/builds/build', locals: { build: build, pipeline_link: true }
|
|
|
|
|
2019-06-14 09:17:18 -04:00
|
|
|
expect(rendered).to have_link('#1337')
|
|
|
|
expect(rendered).to have_text('#1337 by API')
|
2016-11-10 10:00:23 -05:00
|
|
|
end
|
|
|
|
end
|