Add flag for specs that should be skipped if currently not connected to the internet
This commit is contained in:
parent
73971d9b7f
commit
079e6cbca1
|
@ -2568,7 +2568,7 @@ CACHE MANIFEST
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "url blacklisting" do
|
describe "url blacklisting", skip_if_offline: true do
|
||||||
let(:driver) do
|
let(:driver) do
|
||||||
driver_for_app do
|
driver_for_app do
|
||||||
get "/" do
|
get "/" do
|
||||||
|
@ -2651,7 +2651,7 @@ CACHE MANIFEST
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "url whitelisting" do
|
describe "url whitelisting", skip_if_offline: true do
|
||||||
it_behaves_like "output writer" do
|
it_behaves_like "output writer" do
|
||||||
let(:driver) do
|
let(:driver) do
|
||||||
driver_for_html(<<-HTML, browser)
|
driver_for_html(<<-HTML, browser)
|
||||||
|
|
|
@ -23,12 +23,24 @@ Capybara.register_driver :reusable_webkit do |app|
|
||||||
Capybara::Webkit::Driver.new(app, :browser => $webkit_browser)
|
Capybara::Webkit::Driver.new(app, :browser => $webkit_browser)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_internet?
|
||||||
|
require 'resolv'
|
||||||
|
dns_resolver = Resolv::DNS.new
|
||||||
|
begin
|
||||||
|
dns_resolver.getaddress("example.com")
|
||||||
|
true
|
||||||
|
rescue Resolv::ResolvError => e
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
Capybara::SpecHelper.configure(c)
|
Capybara::SpecHelper.configure(c)
|
||||||
|
|
||||||
c.filter_run_excluding :skip_on_windows => !(RbConfig::CONFIG['host_os'] =~ /mingw32/).nil?
|
c.filter_run_excluding :skip_on_windows => !(RbConfig::CONFIG['host_os'] =~ /mingw32/).nil?
|
||||||
c.filter_run_excluding :skip_on_jruby => !defined?(::JRUBY_VERSION).nil?
|
c.filter_run_excluding :skip_on_jruby => !defined?(::JRUBY_VERSION).nil?
|
||||||
c.filter_run_excluding :selenium_compatibility => (Capybara::VERSION =~ /^2\.4\./).nil?
|
c.filter_run_excluding :selenium_compatibility => (Capybara::VERSION =~ /^2\.4\./).nil?
|
||||||
|
c.filter_run_excluding :skip_if_offline => !has_internet?
|
||||||
|
|
||||||
# We can't support outerWidth and outerHeight without a visible window.
|
# We can't support outerWidth and outerHeight without a visible window.
|
||||||
# We focus the next window instead of failing when closing windows.
|
# We focus the next window instead of failing when closing windows.
|
||||||
|
|
Loading…
Reference in New Issue