Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-04-17 01:13:59 +0300
committerConnor Shea <connor.james.shea@gmail.com>2016-04-26 20:40:35 +0300
commitc402aeef027b73b71ad3ca49f79bc2aa6d47b97d (patch)
tree147315c79ad2e80abb6f555b2640060b3c7442a7 /spec
parent88e4802d10361ac1fedaebc413986fe04f9b5498 (diff)
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')
-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')