You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/spec/rails_helper.rb

57 lines
1.6 KiB

# frozen_string_literal: true
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
ENV['TZ'] ||= 'UTC'
require_relative '../config/environment'
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
require 'capybara/cuprite'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
require 'simplecov' if ENV['COVERAGE']
Capybara.server = :puma, { Silent: true }
Capybara.disable_animation = true
Capybara.register_driver(:headless_cuprite) do |app|
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800],
process_timeout: 20,
timeout: 20,
js_errors: true)
end
Capybara.register_driver(:headful_cuprite) do |app|
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800],
headless: false,
process_timeout: 20,
timeout: 20,
js_errors: true)
end
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
abort e.to_s.strip
end
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
config.include FactoryBot::Syntax::Methods
config.before(:each, type: :system) do
if ENV['HEADLESS'] == 'false'
driven_by :headful_cuprite
else
driven_by :headless_cuprite
end
end
end