Sha256: 9fe0a90cb179a3cadf778f4a5013f2fef18878ce9ff97ad5a9224ce04af170e4
Contents?: true
Size: 1.16 KB
Versions: 18
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true require "rails_helper" require "capybara/rspec" require "webmock/rspec" require "resolv" require "socket" def configure_webmock(overrides: []) allowed_hosts = (overrides + [ENV["NULOGY_SSO_MOCKSERVER_HOST"]]).compact WebMock.disable_net_connect!( allow_localhost: true, allow: allowed_hosts ) end Capybara.server = :webrick if ENV["REMOTE_SELENIUM_HOST"].present? ip = Socket.ip_address_list.detect(&:ipv4_private?) rails_server_host = ip.ip_address remote_selenium_host = Resolv.getaddress(ENV.fetch("REMOTE_SELENIUM_HOST")) remote_selenium_port = ENV.fetch("REMOTE_SELENIUM_PORT") Capybara.register_driver :remote do |app| Capybara.server_host = rails_server_host Capybara::Selenium::Driver.new( app, browser: :remote, url: "http://#{remote_selenium_host}:#{remote_selenium_port}/wd/hub", desired_capabilities: :chrome ) end Capybara.javascript_driver = :remote configure_webmock(overrides: [rails_server_host, remote_selenium_host]) else Capybara.javascript_driver = :selenium_chrome configure_webmock end RSpec.configure do |config| config.use_transactional_fixtures = true end
Version data entries
18 entries across 18 versions & 1 rubygems