diff options
author | James Fargher <proglottis@gmail.com> | 2019-07-18 06:45:12 +0300 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2019-07-19 00:23:07 +0300 |
commit | 01431ae3076370bec1c014e326cdb20b47ae55b1 (patch) | |
tree | de042beee18387364ff8420322b31952822b35c1 /spec | |
parent | 34f5eb1b93b5c1e7d8ed8d578d8b94cd33d2dca3 (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.rb | 36 |
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 |