Sha256: c386836cc33586c43ffc4b9f66ac5e31bd34b168d0be47e276b912ee585f8144

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
# load Rails first
require 'rails'

# load the plugin
require 'active_decorator'

Bundler.require
require 'capybara'
require 'selenium/webdriver'

# needs to load the app next
require 'fake_app/fake_app'

require 'test/unit/rails/test_help'

begin
  require 'action_dispatch/system_test_case'
rescue LoadError
  Capybara.register_driver :chrome do |app|
    options = Selenium::WebDriver::Chrome::Options.new(args: %w[no-sandbox headless disable-gpu])
    Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
  end
  Capybara.javascript_driver = :chrome

  class ActionDispatch::IntegrationTest
    include Capybara::DSL
  end
else
  ActionDispatch::SystemTestCase.driven_by(:selenium, using: :headless_chrome)
end

module DatabaseDeleter
  def setup
    Book.delete_all
    Author.delete_all
    Movie.delete_all
    super
  end
end

Test::Unit::TestCase.send :prepend, DatabaseDeleter

CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'authors'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_decorator-1.1.1 test/test_helper.rb
active_decorator-1.1.0 test/test_helper.rb