summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
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