# frozen_string_literal: true ############################################################################## # Capybara Plugin ############################################################################## # # This plugin does not attempt to require capybara. It assumes that if you're # using capybara, you're probably using something like Bundler which has already # required it for you. # # If this is not the case, you will need to require it prior to requiring # rspeckled. # # The same goes for capybara-webkit. It must be required before rspeckled. # begin require 'capybara/rspec' require 'capybara/rails' if defined?(Capybara::Driver::Base) Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, :browser => :chrome) end Capybara.javascript_driver = if defined?(Capybara::Webkit) :webkit else :selenium end RSpec.configure do |config| config.before(:each, :js => true) do page.driver.reset! end end Capybara.configure do |config| config.block_unknown_urls config.match = :prefer_exact config.ignore_hidden_elements = true config.visible_text_only = true end if defined?(Chamber) Capybara.default_host = Chamber.env.http.host_with_port Capybara.app_host = Chamber.env.http.base_url Capybara.server_port = Chamber.env.http.port end end rescue LoadError end