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:
authorStan Hu <stanhu@gmail.com>2015-09-06 19:42:39 +0300
committerStan Hu <stanhu@gmail.com>2015-09-06 19:46:10 +0300
commit8820785c8fe267789a5c6edf7f4fcb196c48b4a8 (patch)
treea22f1cc95905a3f8c8a57781dca25a2f86e3a69d /spec/support
parent50f76ae0eae29f7362702da274055f76a350ee6f (diff)
Fix emoji URLs in Markdown when relative_url_root is used
Also adds the ability to run rspecs with relative_url_defined on the enviornment. For example: RELATIVE_URL_ROOT=/gitlab rspec Closes #1728
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/matchers/markdown_matchers.rb3
-rw-r--r--spec/support/relative_url.rb8
2 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/matchers/markdown_matchers.rb b/spec/support/matchers/markdown_matchers.rb
index 9df226c3af8..7500d0fdf80 100644
--- a/spec/support/matchers/markdown_matchers.rb
+++ b/spec/support/matchers/markdown_matchers.rb
@@ -27,6 +27,9 @@ module MarkdownMatchers
match do |actual|
expect(actual).to have_selector('img.emoji', count: 10)
+
+ image = actual.at_css('img.emoji')
+ expect(image['src'].to_s).to start_with(Gitlab.config.gitlab.url + '/assets')
end
end
diff --git a/spec/support/relative_url.rb b/spec/support/relative_url.rb
new file mode 100644
index 00000000000..72e3ccce75b
--- /dev/null
+++ b/spec/support/relative_url.rb
@@ -0,0 +1,8 @@
+# Fix route helpers in tests (e.g. root_path, ...)
+module RelativeUrl
+ extend ActiveSupport::Concern
+
+ included do
+ default_url_options[:script_name] = Rails.application.config.relative_url_root
+ end
+end