2016-12-02 08:21:04 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-12-05 05:35:27 -05:00
|
|
|
describe Gitlab::Ci::Status::Pipeline::Common do
|
2016-12-08 08:40:21 -05:00
|
|
|
let(:user) { create(:user) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, :private) }
|
2016-12-08 08:51:38 -05:00
|
|
|
let(:pipeline) { create(:ci_pipeline, project: project) }
|
2016-12-02 08:21:04 -05:00
|
|
|
|
|
|
|
subject do
|
2016-12-13 08:29:48 -05:00
|
|
|
Gitlab::Ci::Status::Core
|
2016-12-08 08:40:21 -05:00
|
|
|
.new(pipeline, user)
|
|
|
|
.extend(described_class)
|
2016-12-02 08:21:04 -05:00
|
|
|
end
|
|
|
|
|
2016-12-13 08:29:48 -05:00
|
|
|
describe '#has_action?' do
|
|
|
|
it { is_expected.not_to have_action }
|
2016-12-08 08:51:38 -05:00
|
|
|
end
|
|
|
|
|
2016-12-13 08:29:48 -05:00
|
|
|
describe '#has_details?' do
|
|
|
|
context 'when user has access to read pipeline' do
|
2017-06-14 14:18:56 -04:00
|
|
|
before do
|
|
|
|
project.team << [user, :developer]
|
|
|
|
end
|
2016-12-13 08:29:48 -05:00
|
|
|
|
|
|
|
it { is_expected.to have_details }
|
|
|
|
end
|
2016-12-02 08:21:04 -05:00
|
|
|
|
2016-12-13 08:29:48 -05:00
|
|
|
context 'when user does not have access to read pipeline' do
|
|
|
|
it { is_expected.not_to have_details }
|
|
|
|
end
|
2016-12-02 08:21:04 -05:00
|
|
|
end
|
|
|
|
|
2016-12-13 08:29:48 -05:00
|
|
|
describe '#details_path' do
|
|
|
|
it 'links to the pipeline details page' do
|
|
|
|
expect(subject.details_path)
|
|
|
|
.to include "pipelines/#{pipeline.id}"
|
|
|
|
end
|
2016-12-02 08:21:04 -05:00
|
|
|
end
|
|
|
|
end
|