blob: e8a997a7e43dda0a4de3538f3ce80c7599c1ff38 (
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 '#internal_include_prepended?' do
subject { config.internal_include_prepended? }
it { is_expected.to eq(true) }
end
end
|