21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-11 21:18:38 +02:00
chexpire/test/test_helper.rb

48 lines
1.3 KiB
Ruby

ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
require "minitest/mock"
require_relative "test_mocks_helper"
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include Warden::Test::Helpers
Warden.test_mode!
# Add more helper methods to be used by all tests here...
include ActiveJob::TestHelper
include FactoryBot::Syntax::Methods
include TestMocksHelper
end
# Capybara configuration
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
"chromeOptions" => { args: %w[headless disable-gpu] + ["window-size=1280,800"] },
)
Capybara::Selenium::Driver.new app, browser: :chrome, desired_capabilities: capabilities
end
Capybara.save_path = Rails.root.join("tmp/capybara")
Capybara.javascript_driver = :headless_chrome
# Disable Open4 real system calls
require "open4"
require "errors"
module Open4
def popen4(*)
fail SystemCommandNotAllowedError,
"Real Open4 calls are disabled in test env. Use mock_system_command helper instead."
end
alias open4 popen4
alias pfork4 popen4
alias popen4ext popen4
module_function :open4
module_function :popen4
module_function :pfork4
module_function :popen4ext
end