summaryrefslogtreecommitdiff
path: root/spec/models/repository_spec.rb
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-04-16 16:13:59 -0600
committerConnor Shea <connor.james.shea@gmail.com>2016-04-26 11:40:35 -0600
commitc402aeef027b73b71ad3ca49f79bc2aa6d47b97d (patch)
tree147315c79ad2e80abb6f555b2640060b3c7442a7 /spec/models/repository_spec.rb
parent88e4802d10361ac1fedaebc413986fe04f9b5498 (diff)
downloadgitlab-ce-c402aeef027b73b71ad3ca49f79bc2aa6d47b97d.tar.gz
Allow alternative names for the CHANGELOG file.
"CHANGELOG", "NEWS", "HISTORY", and "CHANGES" are recognized as Changelog files. Also adds relevant tests for each of these names. Resolves #14864.
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r--spec/models/repository_spec.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index c19524a01f8..a306cc4aef8 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -134,7 +134,43 @@ describe Repository, models: true do
end
end
- describe '#license_blob' do
+ describe "#changelog" do
+ before do
+ repository.send(:cache).expire(:changelog)
+ end
+
+ it 'accepts changelog' do
+ expect(repository.tree).to receive(:blobs).and_return([TestBlob.new('changelog')])
+
+ expect(repository.changelog.name).to eq('changelog')
+ end
+
+ it 'accepts news instead of changelog' do
+ expect(repository.tree).to receive(:blobs).and_return([TestBlob.new('news')])
+
+ expect(repository.changelog.name).to eq('news')
+ end
+
+ it 'accepts history instead of changelog' do
+ expect(repository.tree).to receive(:blobs).and_return([TestBlob.new('history')])
+
+ expect(repository.changelog.name).to eq('history')
+ end
+
+ it 'accepts changes instead of changelog' do
+ expect(repository.tree).to receive(:blobs).and_return([TestBlob.new('changes')])
+
+ expect(repository.changelog.name).to eq('changes')
+ end
+
+ it 'is case-insensitive' do
+ expect(repository.tree).to receive(:blobs).and_return([TestBlob.new('CHANGELOG')])
+
+ expect(repository.changelog.name).to eq('CHANGELOG')
+ end
+ end
+
+ describe "#license_blob" do
before do
repository.send(:cache).expire(:license_blob)
repository.remove_file(user, 'LICENSE', 'Remove LICENSE', 'master')