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
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/git_spec.rb')
-rw-r--r--spec/lib/gitlab/git_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/lib/gitlab/git_spec.rb b/spec/lib/gitlab/git_spec.rb
index f359679a930..0f6ef55b4b1 100644
--- a/spec/lib/gitlab/git_spec.rb
+++ b/spec/lib/gitlab/git_spec.rb
@@ -7,10 +7,18 @@ RSpec.describe Gitlab::Git do
let(:committer_name) { 'John Doe' }
describe '.ref_name' do
+ let(:ref) { Gitlab::Git::BRANCH_REF_PREFIX + "an_invalid_ref_\xE5" }
+
it 'ensure ref is a valid UTF-8 string' do
- utf8_invalid_ref = Gitlab::Git::BRANCH_REF_PREFIX + "an_invalid_ref_\xE5"
+ expect(described_class.ref_name(ref)).to eq("an_invalid_ref_%E5")
+ end
- expect(described_class.ref_name(utf8_invalid_ref)).to eq("an_invalid_ref_å")
+ context 'when ref contains characters \x80 - \xFF' do
+ let(:ref) { Gitlab::Git::BRANCH_REF_PREFIX + "\x90" }
+
+ it 'correctly converts it' do
+ expect(described_class.ref_name(ref)).to eq("%90")
+ end
end
end