Sha256: e485d4e41b44bf8746e55c0c6f0a5c3b17efc60cc98493e6acb0dcdb54f043ec

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

require 'cucumber/rails'
require 'factory_bot'
require 'database_cleaner'
require 'cucumber/rspec/doubles'

Dir[File.join(File.dirname(__FILE__), '..', '..', "spec/support/*.rb")].each {|f| require f}

ENV["RAILS_ENV"] = "test"

Capybara.default_selector = :css

ActiveSupport.on_load(:action_controller) do
  self.allow_rescue = false
end

World(FactoryBot::Syntax::Methods)

begin
  DatabaseCleaner.strategy = :transaction
rescue NameError
  raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

Cucumber::Rails::Database.javascript_strategy = :truncation

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.register_driver :headless_chrome do |app|
  caps = Selenium::WebDriver::Remote::Capabilities.chrome(loggingPrefs: { browser: 'ALL' })
  opts = Selenium::WebDriver::Chrome::Options.new

  chrome_args = %w[--headless --window-size=1920,1080 --no-sandbox --disable-dev-shm-usage]
  chrome_args.each { |arg| opts.add_argument(arg) }
  Capybara::Selenium::Driver.new(app, browser: :chrome, options: opts, desired_capabilities: caps)
end

Capybara.configure do |config|
  # change this to :chrome to observe tests in a real browser
  config.javascript_driver = :headless_chrome
end

Before do
  allow_any_instance_of(DeviseController).to receive(:devise_mapping) { Devise.mappings[:user] }
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
devise_masquerade-2.1.3 features/support/env.rb
devise_masquerade-2.1.2 features/support/env.rb
devise_masquerade-2.1.0 features/support/env.rb
devise_masquerade-2.0.3 features/support/env.rb
devise_masquerade-2.0.2 features/support/env.rb
devise_masquerade-2.0.1 features/support/env.rb
devise_masquerade-2.0.0 features/support/env.rb
devise_masquerade-1.3.12 features/support/env.rb
devise_masquerade-1.3.11 features/support/env.rb
devise_masquerade-1.3.10 features/support/env.rb
devise_masquerade-1.3.9 features/support/env.rb
devise_masquerade-1.3.8 features/support/env.rb
devise_masquerade-1.3.7 features/support/env.rb
devise_masquerade-1.3.6 features/support/env.rb
devise_masquerade-1.3.5 features/support/env.rb
devise_masquerade-1.3.4 features/support/env.rb
devise_masquerade-1.3.3 features/support/env.rb
devise_masquerade-1.3.2 features/support/env.rb
devise_masquerade-1.3.1 features/support/env.rb
devise_masquerade-1.3.0 features/support/env.rb