summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-14 13:21:59 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-06-19 09:29:54 +0200
commit9ae8b57467ac8b38f1fa9020a466d94a93cbb9dd (patch)
tree3b6d88279c11964189cf9276ca63251dadeece67
parent0f18d4896c63ad91074f1963737f5ba4458031f0 (diff)
downloadgitlab-ce-9ae8b57467ac8b38f1fa9020a466d94a93cbb9dd.tar.gz
Move language detection to mandatory
Closes https://gitlab.com/gitlab-org/gitaly/issues/732 Closes https://gitlab.com/gitlab-org/gitaly/issues/360
-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 5bae99101e6..10a264a5030 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