2019-10-08 12:06:01 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-10 15:00:23 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.describe 'projects/generic_commit_statuses/_generic_commit_status.html.haml' do
|
2016-11-10 15:00:23 +00:00
|
|
|
include Devise::Test::ControllerHelpers
|
|
|
|
|
2017-03-27 20:20:27 +00:00
|
|
|
let(:project) { create(:project, :repository) }
|
2016-11-10 15:00:23 +00:00
|
|
|
let(:pipeline) { create(:ci_empty_pipeline, id: 1337, project: project, sha: project.commit.id) }
|
|
|
|
let(:generic_commit_status) { create(:generic_commit_status, pipeline: pipeline, stage: 'external', name: 'jenkins', stage_idx: 3) }
|
|
|
|
|
|
|
|
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/generic_commit_statuses/generic_commit_status', locals: { generic_commit_status: generic_commit_status }
|
|
|
|
|
|
|
|
expect(rendered).not_to have_link('#1337')
|
|
|
|
expect(rendered).not_to have_text('#1337 by API')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'can include a column with a link to its pipeline' do
|
|
|
|
render partial: 'projects/generic_commit_statuses/generic_commit_status', locals: { generic_commit_status: generic_commit_status, pipeline_link: true }
|
|
|
|
|
|
|
|
expect(rendered).to have_link('#1337')
|
|
|
|
expect(rendered).to have_text('#1337 by API')
|
|
|
|
end
|
|
|
|
end
|