summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/markdown/relative_link_filter_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-07-31 14:20:28 +0200
committerDouwe Maan <douwe@gitlab.com>2015-07-31 14:20:28 +0200
commitf71d67dda172a996b23b541b0e26c2c7edc06072 (patch)
treeb4df56c135b47897507d30ac855bfc10da03781c /spec/lib/gitlab/markdown/relative_link_filter_spec.rb
parent66cc712fa516d758ab09f22ffe78b85cb4415740 (diff)
parenta51a3fb8ed92a58b375125b19f75c3d4c545571a (diff)
downloadgitlab-ce-add-license.tar.gz
Merge branch 'master' into add-licenseadd-license
Diffstat (limited to 'spec/lib/gitlab/markdown/relative_link_filter_spec.rb')
-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