summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-11-28 16:43:46 +0000
committerAlfredo Sumaran <alfredo@gitlab.com>2016-11-28 16:43:46 +0000
commitc54827961a6ecefc6cb3361b3978d169e29b5e36 (patch)
tree2652971df42666a68a3c07cf504af3065ce8d075 /spec/support
parentcfb4d65f84898f433771e2deafc36d597db9b8df (diff)
parent31a5ed97a74e250887721413f5a956a93dc2e1b1 (diff)
downloadgitlab-ce-c54827961a6ecefc6cb3361b3978d169e29b5e36.tar.gz
Merge branch 'dynamic-build-fixture' into 'master'
Create dynamic fixture for build_spec ## What does this MR do? Replace `spec/javascripts/fixtures/build.html.haml` by a dynamically created fixture (using `rake teaspoon:fixtures`). ## Why was this MR needed? The existing fixture was not representing the real page. ## What are the relevant issue numbers? #24614 would have been avoided following !6059 See merge request !7589
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/javascript_fixtures_helpers.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb
index adc3f48b434..99e98eebdb4 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'
@@ -30,13 +31,17 @@ 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
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))