Files
nairobi/spec/rails_helper.rb
Senén Rodero Rodríguez 7a33314ceb Remove Capybara default_set_options for system tests using the Rack Test driver
The next warning is flooding the tests log:

`Options passed to Node#set but the RackTest driver
doesn't support any - ignoring`

As the rack test driver does not support any option, we
get rid of all `default_set_options` before each system
spec that uses this driver.
2021-06-10 12:33:55 +02:00

53 lines
1.3 KiB
Ruby

ENV["RAILS_ENV"] ||= "test"
if ENV["COVERALLS_REPO_TOKEN"]
require "coveralls"
Coveralls.wear!("rails")
end
require File.expand_path("../../config/environment", __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require "rspec/rails"
require "spec_helper"
require "capybara/rails"
require "capybara/rspec"
require "selenium/webdriver"
require "view_component/test_helpers"
RSpec.configure do |config|
config.include ViewComponent::TestHelpers, type: :component
end
Rails.application.load_tasks if Rake::Task.tasks.empty?
include Warden::Test::Helpers
Warden.test_mode!
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.infer_spec_type_from_file_location!
config.after do
Warden.test_reset!
end
end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
"goog:chromeOptions" => {
args: %W[headless no-sandbox window-size=1200,800 proxy-server=#{Capybara.app_host}:#{Capybara::Webmock.port_number}]
}
)
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: capabilities
)
end
Capybara.exact = true
Capybara.enable_aria_label = true
Capybara.disable_animation = true
OmniAuth.config.test_mode = true