summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-06-19 09:56:45 +0000
committerDouwe Maan <douwe@gitlab.com>2018-06-19 09:56:45 +0000
commitf70c581d1fb633767a5874fcdc5f0699095546ca (patch)
tree67f0b501dc505d2aa860c02e23573f682d26d5cb
parent51334904f5eec93de90fe3d81cef080d6f54f52f (diff)
parent9ae8b57467ac8b38f1fa9020a466d94a93cbb9dd (diff)
downloadgitlab-ce-f70c581d1fb633767a5874fcdc5f0699095546ca.tar.gz
Merge branch 'zj-linguist-gitaly-mandatory' into 'master'
Move language detection to mandatory Closes gitaly#732 and gitaly#360 See merge request gitlab-org/gitlab-ce!19985
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb46
1 files changed, 19 insertions, 27 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index f0e7e390f8b..9329442fad1 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -1688,41 +1688,33 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
describe '#languages' do
- shared_examples 'languages' do
- it 'returns exactly the expected results' do
- languages = repository.languages('4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6')
- expected_languages = [
- { value: 66.63, label: "Ruby", color: "#701516", highlight: "#701516" },
- { value: 22.96, label: "JavaScript", color: "#f1e05a", highlight: "#f1e05a" },
- { value: 7.9, label: "HTML", color: "#e34c26", highlight: "#e34c26" },
- { value: 2.51, label: "CoffeeScript", color: "#244776", highlight: "#244776" }
- ]
+ it 'returns exactly the expected results' do
+ languages = repository.languages('4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6')
+ expected_languages = [
+ { value: 66.63, label: "Ruby", color: "#701516", highlight: "#701516" },
+ { value: 22.96, label: "JavaScript", color: "#f1e05a", highlight: "#f1e05a" },
+ { value: 7.9, label: "HTML", color: "#e34c26", highlight: "#e34c26" },
+ { value: 2.51, label: "CoffeeScript", color: "#244776", highlight: "#244776" }
+ ]
- expect(languages.size).to eq(expected_languages.size)
+ expect(languages.size).to eq(expected_languages.size)
- expected_languages.size.times do |i|
- a = expected_languages[i]
- b = languages[i]
+ expected_languages.size.times do |i|
+ a = expected_languages[i]
+ b = languages[i]
- expect(a.keys.sort).to eq(b.keys.sort)
- expect(a[:value]).to be_within(0.1).of(b[:value])
+ expect(a.keys.sort).to eq(b.keys.sort)
+ expect(a[:value]).to be_within(0.1).of(b[:value])
- non_float_keys = a.keys - [:value]
- expect(a.values_at(*non_float_keys)).to eq(b.values_at(*non_float_keys))
- end
- end
-
- it "uses the repository's HEAD when no ref is passed" do
- lang = repository.languages.first
-
- expect(lang[:label]).to eq('Ruby')
+ non_float_keys = a.keys - [:value]
+ expect(a.values_at(*non_float_keys)).to eq(b.values_at(*non_float_keys))
end
end
- it_behaves_like 'languages'
+ it "uses the repository's HEAD when no ref is passed" do
+ lang = repository.languages.first
- context 'with rugged', :skip_gitaly_mock do
- it_behaves_like 'languages'
+ expect(lang[:label]).to eq('Ruby')
end
end