summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/markdown
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-07-30 17:25:07 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-07-30 17:25:07 -0400
commit4e22dcb6a34f43e5b3b2700ec72b32354315adc0 (patch)
tree3e9171bfad132e20d7d5a1c26452c88d4b327d7b /spec/lib/gitlab/markdown
parent6d6f807b759d13d111202129d8be2c88d7be819f (diff)
downloadgitlab-ce-4e22dcb6a34f43e5b3b2700ec72b32354315adc0.tar.gz
Add spec to RelativeLinkFilter for Unicode filenames
Diffstat (limited to 'spec/lib/gitlab/markdown')
-rw-r--r--spec/lib/gitlab/markdown/relative_link_filter_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/markdown/relative_link_filter_spec.rb b/spec/lib/gitlab/markdown/relative_link_filter_spec.rb
index 5ee5310825d..7f4d67e403f 100644
--- a/spec/lib/gitlab/markdown/relative_link_filter_spec.rb
+++ b/spec/lib/gitlab/markdown/relative_link_filter_spec.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require 'spec_helper'
module Gitlab::Markdown
@@ -101,6 +103,20 @@ module Gitlab::Markdown
expect(doc.at_css('a')['href']).to eq 'http://example.com'
end
+ it 'supports Unicode filenames' do
+ path = 'files/images/한글.png'
+ escaped = Addressable::URI.escape(path)
+
+ # Stub these methods so the file doesn't actually need to be in the repo
+ allow_any_instance_of(described_class).to receive(:file_exists?).
+ and_return(true)
+ allow_any_instance_of(described_class).
+ to receive(:image?).with(path).and_return(true)
+
+ doc = filter(image(escaped))
+ expect(doc.at_css('img')['src']).to match '/raw/'
+ end
+
context 'when requested path is a file in the repo' do
let(:requested_path) { 'doc/api/README.md' }
include_examples :relative_to_requested