Skip to content

Instantly share code, notes, and snippets.

@alex-ross
Last active December 26, 2018 20:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-ross/5974eabf01ee319630f1652556235271 to your computer and use it in GitHub Desktop.
Save alex-ross/5974eabf01ee319630f1652556235271 to your computer and use it in GitHub Desktop.
Nanobox + Capybara + Rails + RSpec
# boxfile.yaml
# ...
data.chrome:
image: selenium/standalone-chrome
local_only: true
# ...
# Gemfile
group :development, :test do
gem 'rspec-rails'
gem "capybara"
gem "selenium-webdriver"
end
# spec/rails_helper.rb
# ...
Capybara.register_driver :remote_chrome do |driver|
Capybara::Selenium::Driver.new(driver,
browser: :remote,
desired_capabilities: :chrome,
url: "http://#{ENV["DATA_CHROME_HOST"]}:4444/wd/hub")
end
Capybara.server_host = ENV["HOSTNAME"]
Capybara.javascript_driver = :remote_chrome
Capybara.default_driver = :remote_chrome
# And if you have VCR as well you can comment out this
######################################################
#VCR.configure do |config|
# ignore_hosts = %w[localhost 127.0.0.1]
# ignore_hosts << ENV["DATA_CHROME_HOST"] if ENV["DATA_CHROME_HOST"].present?
# ignore_hosts << ENV["HOSTNAME"] if ENV["HOSTNAME"].present?
# config.ignore_hosts(*ignore_hosts)
#end
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment