summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-12-11 10:33:03 +0100
committerDouwe Maan <douwe@gitlab.com>2015-12-11 10:33:03 +0100
commitcd97dba2a9a26e83818f7e111bc0b0185a7ced8a (patch)
tree23195397edc1d24b527f793b4275087320c14cd5 /spec/models
parent73942b15e775d34ea3563545942978a726c5f28e (diff)
parenta2798e8d06641be61e8a44682984c2d4b123e70f (diff)
downloadgitlab-ce-cd97dba2a9a26e83818f7e111bc0b0185a7ced8a.tar.gz
Merge branch 'zj/gitlab-ce-copying-file-seen-as-licence'
Diffstat (limited to 'spec/models')
-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 e6c415da267..afbf62035ac 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -103,6 +103,26 @@ describe Repository, models: true do
end
+ describe "#license" do
+ before do
+ repository.send(:cache).expire(:license)
+ TestBlob = Struct.new(:name)
+ end
+
+ it 'test selection preference' do
+ files = [TestBlob.new('file'), TestBlob.new('license'), TestBlob.new('copying')]
+ expect(repository.tree).to receive(:blobs).and_return(files)
+
+ expect(repository.license.name).to eq('license')
+ end
+
+ it 'also accepts licence instead of license' do
+ expect(repository.tree).to receive(:blobs).and_return([TestBlob.new('licence')])
+
+ expect(repository.license.name).to eq('licence')
+ end
+ end
+
describe :add_branch do
context 'when pre hooks were successful' do
it 'should run without errors' do
@@ -199,5 +219,4 @@ describe Repository, models: true do
end
end
end
-
end