From 918bc207c680bed46e82bef996aea027ac72b38d Mon Sep 17 00:00:00 2001 From: winniehell Date: Sat, 19 Nov 2016 22:59:32 +0100 Subject: Use Rails test host name for frontend fixtures --- spec/support/javascript_fixtures_helpers.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/support/javascript_fixtures_helpers.rb') diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb index adc3f48b434..7e066aa115d 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/javascript_fixtures_helpers.rb @@ -1,3 +1,4 @@ +require 'action_dispatch/testing/test_request' require 'fileutils' require 'gitlab/popen' @@ -36,7 +37,8 @@ module JavaScriptFixturesHelpers fixture = doc.to_html # replace relative links - fixture.gsub!(%r{="/}, '="https://fixture.invalid/') + test_host = ActionDispatch::TestRequest::DEFAULT_ENV['HTTP_HOST'] + fixture.gsub!(%r{="/}, "=\"http://#{test_host}/") end FileUtils.mkdir_p(File.dirname(fixture_file_name)) -- cgit v1.2.1 From d9fe5c259d8880fcb9f8c1cc3322836d4d35ef93 Mon Sep 17 00:00:00 2001 From: winniehell Date: Wed, 23 Nov 2016 21:36:34 +0100 Subject: Strip tags from fixtures to ignore CSS --- spec/support/javascript_fixtures_helpers.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'spec/support/javascript_fixtures_helpers.rb') diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb index 7e066aa115d..99e98eebdb4 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/javascript_fixtures_helpers.rb @@ -31,6 +31,9 @@ module JavaScriptFixturesHelpers if response_mime_type.html? doc = Nokogiri::HTML::DocumentFragment.parse(fixture) + link_tags = doc.css('link') + link_tags.remove + scripts = doc.css('script') scripts.remove -- cgit v1.2.1