summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-26 09:57:47 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-03-26 09:57:47 +0000
commit2fdf928afaed93958e86aa951897bf63757a578d (patch)
tree7c3fbf98d20e7d8e6e08ec22f18bfcb4248e7b14 /spec
parent43e49f52e30199c9724329e71f375874eb76d554 (diff)
parent179bae9968e6da5c09a1789fba7c4b706e144804 (diff)
downloadgitlab-ce-2fdf928afaed93958e86aa951897bf63757a578d.tar.gz
Merge branch 'ci-setup-info' into 'master'
Add links to CI setup documentation from project settings and builds pages For #14483 Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> See merge request !3384
Diffstat (limited to 'spec')
-rw-r--r--spec/models/repository_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 7eac70ae948..417f11acca4 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -2,6 +2,7 @@ require 'spec_helper'
describe Repository, models: true do
include RepoHelpers
+ TestBlob = Struct.new(:name)
let(:repository) { create(:project).repository }
let(:user) { create(:user) }
@@ -131,7 +132,6 @@ describe Repository, models: true do
describe "#license" do
before do
repository.send(:cache).expire(:license)
- TestBlob = Struct.new(:name)
end
it 'test selection preference' do
@@ -148,6 +148,25 @@ describe Repository, models: true do
end
end
+ describe "#gitlab_ci_yml" do
+ it 'returns valid file' do
+ files = [TestBlob.new('file'), TestBlob.new('.gitlab-ci.yml'), TestBlob.new('copying')]
+ expect(repository.tree).to receive(:blobs).and_return(files)
+
+ expect(repository.gitlab_ci_yml.name).to eq('.gitlab-ci.yml')
+ end
+
+ it 'returns nil if not exists' do
+ expect(repository.tree).to receive(:blobs).and_return([])
+ expect(repository.gitlab_ci_yml).to be_nil
+ end
+
+ it 'returns nil for empty repository' do
+ expect(repository).to receive(:empty?).and_return(true)
+ expect(repository.gitlab_ci_yml).to be_nil
+ end
+ end
+
describe :add_branch do
context 'when pre hooks were successful' do
it 'should run without errors' do