From 03ec8486c6a70389c5f19815c85e1376e386935f Mon Sep 17 00:00:00 2001 From: Jonas Nicklas Date: Mon, 6 Jan 2014 16:17:58 +0100 Subject: [PATCH] Navigate to about:blank to reset page instead of empty file closes #1035 closes #1214 closes #1203 closes #1198 closes #1215 Since it does not work with remote drivers, and somehow screws up on Windows. --- lib/capybara.rb | 2 -- lib/capybara/empty.html | 4 ---- lib/capybara/selenium/driver.rb | 4 +--- lib/capybara/spec/session/reset_session_spec.rb | 13 ++----------- 4 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 lib/capybara/empty.html diff --git a/lib/capybara.rb b/lib/capybara.rb index 50446f6f..efa25456 100644 --- a/lib/capybara.rb +++ b/lib/capybara.rb @@ -14,8 +14,6 @@ module Capybara class NotSupportedByDriverError < CapybaraError; end class InfiniteRedirectError < CapybaraError; end - EMPTY_HTML_FILE_PATH = File.expand_path('./capybara/empty.html', File.dirname(__FILE__)) - class << self attr_accessor :asset_host, :app_host, :run_server, :default_host, :always_include_port attr_accessor :server_port, :exact, :match, :exact_options, :visible_text_only diff --git a/lib/capybara/empty.html b/lib/capybara/empty.html deleted file mode 100644 index 71572691..00000000 --- a/lib/capybara/empty.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/lib/capybara/selenium/driver.rb b/lib/capybara/selenium/driver.rb index 3f815d3b..73ae4938 100644 --- a/lib/capybara/selenium/driver.rb +++ b/lib/capybara/selenium/driver.rb @@ -97,9 +97,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base # to about:blank, so we rescue this error and do nothing # instead. end - uri = URI(Capybara::EMPTY_HTML_FILE_PATH) - uri.scheme = "file" - @browser.navigate.to(uri.to_s) + @browser.navigate.to("about:blank") end end diff --git a/lib/capybara/spec/session/reset_session_spec.rb b/lib/capybara/spec/session/reset_session_spec.rb index f8ae4e0f..98345be3 100644 --- a/lib/capybara/spec/session/reset_session_spec.rb +++ b/lib/capybara/spec/session/reset_session_spec.rb @@ -16,17 +16,8 @@ Capybara::SpecHelper.spec '#reset_session!' do @session.current_path.should == '/foo' @session.reset_session! - [ - ->(v) { v == nil }, - ->(v) { v == '' }, - ->(v) { v == 'about:blank' }, - ->(v) { v.end_with? Capybara::EMPTY_HTML_FILE_PATH } # allow file:// protocol - ].any? { |p| p.(@session.current_url) }.should be_true - [ - ->(v) { v == '' }, - ->(v) { v == nil }, - ->(v) { v == Capybara::EMPTY_HTML_FILE_PATH } - ].any? { |p| p.(@session.current_path) }.should be_true + [nil, '', 'about:blank'].should include(@session.current_url) + ['', nil].should include(@session.current_path) @session.current_host.should be_nil end