summaryrefslogtreecommitdiff
path: root/spec/models/ci/pipeline_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 15:06:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 15:06:34 +0000
commitf1a5755898e865428c923587402fd965b601c4ea (patch)
treea93aab01a1d3ba0e93c0fbf1450babfe4674f9dc /spec/models/ci/pipeline_spec.rb
parent1ae627c65192ae1a01fdac253065ef561a9d6b7e (diff)
downloadgitlab-ce-f1a5755898e865428c923587402fd965b601c4ea.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ci/pipeline_spec.rb')
-rw-r--r--spec/models/ci/pipeline_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index d5ad70194cb..fdd0cd8a3b7 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -1755,6 +1755,30 @@ describe Ci::Pipeline, :mailer do
end
end
+ describe '#all_worktree_paths' do
+ let(:files) { { 'main.go' => '', 'mocks/mocks.go' => '' } }
+ let(:project) { create(:project, :custom_repo, files: files) }
+ let(:pipeline) { build(:ci_pipeline, project: project, sha: project.repository.head_commit.sha) }
+
+ it 'returns all file paths cached' do
+ expect(project.repository).to receive(:ls_files).with(pipeline.sha).once.and_call_original
+ expect(pipeline.all_worktree_paths).to eq(files.keys)
+ expect(pipeline.all_worktree_paths).to eq(files.keys)
+ end
+ end
+
+ describe '#top_level_worktree_paths' do
+ let(:files) { { 'main.go' => '', 'mocks/mocks.go' => '' } }
+ let(:project) { create(:project, :custom_repo, files: files) }
+ let(:pipeline) { build(:ci_pipeline, project: project, sha: project.repository.head_commit.sha) }
+
+ it 'returns top-level file paths cached' do
+ expect(project.repository).to receive(:tree).with(pipeline.sha).once.and_call_original
+ expect(pipeline.top_level_worktree_paths).to eq(['main.go'])
+ expect(pipeline.top_level_worktree_paths).to eq(['main.go'])
+ end
+ end
+
describe '#has_kubernetes_active?' do
context 'when kubernetes is active' do
context 'when user configured kubernetes from CI/CD > Clusters' do