blob: b31a909934879bf981053c4007d925141b1b68f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Ci::ProjectConfig::Repository, feature_category: :continuous_integration do
let(:project) { create(:project, :custom_repo, files: files) }
let(:sha) { project.repository.head_commit.sha }
let(:files) { { 'README.md' => 'hello' } }
subject(:config) { described_class.new(project, sha, nil, nil, nil) }
describe '#content' do
subject(:content) { config.content }
context 'when file is in repository' do
let(:config_content_result) do
<<~CICONFIG
---
include:
- local: ".gitlab-ci.yml"
CICONFIG
end
let(:files) { { '.gitlab-ci.yml' => 'content' } }
it { is_expected.to eq(config_content_result) }
end
context 'when file is not in repository' do
it { is_expected.to be_nil }
end
context 'when Gitaly raises error' do
before do
allow(project.repository).to receive(:gitlab_ci_yml_for).and_raise(GRPC::Internal)
end
it { is_expected.to be_nil }
end
end
describe '#source' do
subject { config.source }
it { is_expected.to eq(:repository_source) }
end
describe '#contains_internal_include?' do
subject { config.contains_internal_include? }
it { is_expected.to eq(true) }
end
end
|