summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-06-28 14:20:29 +0200
committerJacob Vosmaer <jacob@gitlab.com>2017-06-28 16:15:59 +0200
commitd3bcf8ac2ae7e89d0ec6eddcd6374bc1e1c8b5fb (patch)
treefa27c099ceba89aeb6db1b518168addd2f0c82f4 /spec/lib/gitlab/git
parent4596ab5b6b2cb7a2f78babe62268bb66b6fd2449 (diff)
downloadgitlab-ce-d3bcf8ac2ae7e89d0ec6eddcd6374bc1e1c8b5fb.tar.gz
Fix gitaly ref encoding bugs
Diffstat (limited to 'spec/lib/gitlab/git')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index ee25aeefa95..0cd458bf933 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -26,6 +26,10 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
+ it 'returns UTF-8' do
+ expect(repository.root_ref.encoding).to eq(Encoding.find('UTF-8'))
+ end
+
context 'with gitaly enabled' do
before do
stub_gitaly
@@ -123,6 +127,11 @@ describe Gitlab::Git::Repository, seed_helper: true do
it 'has SeedRepo::Repo::BRANCHES.size elements' do
expect(subject.size).to eq(SeedRepo::Repo::BRANCHES.size)
end
+
+ it 'returns UTF-8' do
+ expect(subject.first.encoding).to eq(Encoding.find('UTF-8'))
+ end
+
it { is_expected.to include("master") }
it { is_expected.not_to include("branch-from-space") }
@@ -158,10 +167,15 @@ describe Gitlab::Git::Repository, seed_helper: true do
subject { repository.tag_names }
it { is_expected.to be_kind_of Array }
+
it 'has SeedRepo::Repo::TAGS.size elements' do
expect(subject.size).to eq(SeedRepo::Repo::TAGS.size)
end
+ it 'returns UTF-8' do
+ expect(subject.first.encoding).to eq(Encoding.find('UTF-8'))
+ end
+
describe '#last' do
subject { super().last }
it { is_expected.to eq("v1.2.1") }
@@ -1276,6 +1290,16 @@ describe Gitlab::Git::Repository, seed_helper: true do
Gitlab::GitalyClient.clear_stubs!
end
+ it 'returns a Branch with UTF-8 fields' do
+ branches = @repo.local_branches.to_a
+ expect(branches.size).to be > 0
+ utf_8 = Encoding.find('utf-8')
+ branches.each do |branch|
+ expect(branch.name.encoding).to eq(utf_8)
+ expect(branch.target.encoding).to eq(utf_8) unless branch.target.nil?
+ end
+ end
+
it 'gets the branches from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:local_branches)
.and_return([])