diff --git a/Gemfile b/Gemfile index b677a321c9eaead17cb7262971a68d4910f3bd41..0bdbdad652d49e113fa58a62616bebc1097e6b10 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,7 @@ group :test do gem "selenium-webdriver" gem "shoulda-matchers" gem "timecop" + gem "webdrivers" gem "webmock" gem "xpath", "3.2.0" end diff --git a/Gemfile.lock b/Gemfile.lock index 4ea64c45357cfc3ee8e7173c34f9f7792c6ee3cc..fbc157c9f0b123d9b5aecc621734292836e20d59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -304,6 +304,10 @@ GEM unicorn (6.0.0) kgio (~> 2.6) raindrops (~> 0.7) + webdrivers (5.0.0) + nokogiri (~> 1.6) + rubyzip (>= 1.3.0) + selenium-webdriver (~> 4.0) webmock (3.14.0) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -352,6 +356,7 @@ DEPENDENCIES timecop uglifier unicorn + webdrivers webmock xpath (= 3.2.0) yard diff --git a/bin/setup b/bin/setup index d39fed70a95f8026df46de64e74eab109abf6b05..bac8ad9741c006a2b13f6066b92c1bdbc798b5d7 100755 --- a/bin/setup +++ b/bin/setup @@ -23,11 +23,6 @@ bundle exec rake db:setup dev:prime # Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv mkdir -p .git/safe -if ! command -v chromedriver > /dev/null; then - printf 'chromedriver is not installed.\n' - printf 'See https://chromedriver.chromium.org for install instructions.\n' -fi - # Only if this isn't CI # if [ -z "$CI" ]; then # fi diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 582d843966e11002ea935425a6639cb88c23a8a1..bf7687ba2bb8c64b0891d6773bda592396857cb9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,3 @@ -require "webmock/rspec" - # http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| config.expect_with :rspec do |expectations| @@ -12,5 +10,3 @@ RSpec.configure do |config| config.order = :random end - -WebMock.disable_net_connect!(allow_localhost: true) diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb new file mode 100644 index 0000000000000000000000000000000000000000..dbca72cb8786a8a28e63daa1faaa78958fbd219a --- /dev/null +++ b/spec/support/webmock.rb @@ -0,0 +1,11 @@ +require "webmock/rspec" + +# Allow downloading webdrivers for Selenium +driver_hosts = Webdrivers::Common.subclasses. + map { |driver| URI(driver.base_url).host } + +# Downloading the Firefox driver involves a redirect +driver_hosts += ["github-releases.githubusercontent.com"] + +# Additionally, avoid conflict with Selenium (localhost) +WebMock.disable_net_connect!(allow_localhost: true, allow: driver_hosts)