Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2019-07-18 06:45:12 +0300
committerJames Fargher <proglottis@gmail.com>2019-07-19 00:23:07 +0300
commit01431ae3076370bec1c014e326cdb20b47ae55b1 (patch)
treede042beee18387364ff8420322b31952822b35c1 /spec
parent34f5eb1b93b5c1e7d8ed8d578d8b94cd33d2dca3 (diff)
Initial detection of Auto-DevOps buildable projectsauto_devops_detect2
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/auto_devops/buildable_detector_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/gitlab/auto_devops/buildable_detector_spec.rb b/spec/lib/gitlab/auto_devops/buildable_detector_spec.rb
new file mode 100644
index 00000000000..42187def844
--- /dev/null
+++ b/spec/lib/gitlab/auto_devops/buildable_detector_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Gitlab::AutoDevops::BuildableDetector do
+ describe '#buildable?' do
+ let(:project) { create(:project) }
+ let(:ref) { :head }
+
+ subject(:detector) { described_class.new(project, ref) }
+
+ context 'no matching variables or files' do
+ it 'is not buildable' do
+ expect(detector).to_not be_buildable
+ end
+ end
+
+ context 'matching variable' do
+ before do
+ create(:ci_variable, project: project, key: 'BUILDPACK_URL')
+ end
+
+ it 'is buildable' do
+ expect(detector).to be_buildable
+ end
+ end
+
+ context 'matching file' do
+ let(:project) { create(:project, :custom_repo, files: { 'Dockerfile' => '' }) }
+
+ it 'is buildable' do
+ expect(detector).to be_buildable
+ end
+ end
+ end
+end