| 
 | 1 | +$LOAD_PATH.unshift(File.dirname(__FILE__))  | 
 | 2 | +$LOAD_PATH << File.expand_path('../support', __FILE__)  | 
 | 3 | + | 
 | 4 | +ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)  | 
 | 5 | +require "bundler"  | 
 | 6 | +Bundler.setup  | 
 | 7 | + | 
 | 8 | +ENV['RAILS_ENV'] = 'test'  | 
 | 9 | +# Ensure the Active Admin load path is happy  | 
 | 10 | +require 'rails'  | 
 | 11 | +ENV['RAILS'] = Rails.version  | 
 | 12 | +ENV['RAILS_ROOT'] = File.expand_path("../rails/rails-#{ENV['RAILS']}", __FILE__)  | 
 | 13 | +# Create the test app if it doesn't exists  | 
 | 14 | +unless File.exists?(ENV['RAILS_ROOT'])  | 
 | 15 | + system 'rake setup'  | 
 | 16 | +end  | 
 | 17 | + | 
 | 18 | +require 'active_model'  | 
 | 19 | +# require ActiveRecord to ensure that Ransack loads correctly  | 
 | 20 | +require 'active_record'  | 
 | 21 | +require 'active_admin'  | 
 | 22 | +ActiveAdmin.application.load_paths = [ENV['RAILS_ROOT'] + "/app/admin"]  | 
 | 23 | +require ENV['RAILS_ROOT'] + '/config/environment.rb'  | 
 | 24 | +# Disabling authentication in specs so that we don't have to worry about  | 
 | 25 | +# it allover the place  | 
 | 26 | +ActiveAdmin.application.authentication_method = false  | 
 | 27 | +ActiveAdmin.application.current_user_method = false  | 
 | 28 | + | 
 | 29 | +require 'rspec/rails'  | 
 | 30 | +require 'support/admin'  | 
 | 31 | +require 'capybara/rails'  | 
 | 32 | +require 'capybara/rspec'  | 
 | 33 | +require 'capybara/poltergeist'  | 
 | 34 | + | 
 | 35 | + | 
 | 36 | +RSpec.configure do |config|  | 
 | 37 | + config.use_transactional_fixtures = false  | 
 | 38 | + | 
 | 39 | + config.before(:suite) do  | 
 | 40 | + DatabaseCleaner.strategy = :truncation  | 
 | 41 | + DatabaseCleaner.clean_with(:truncation)  | 
 | 42 | + end  | 
 | 43 | + config.before(:each) do  | 
 | 44 | + DatabaseCleaner.strategy = :truncation  | 
 | 45 | + DatabaseCleaner.start  | 
 | 46 | + end  | 
 | 47 | + config.after(:each) do  | 
 | 48 | + DatabaseCleaner.clean  | 
 | 49 | + end  | 
 | 50 | + | 
 | 51 | +end  | 
 | 52 | + | 
 | 53 | +# RSpec.configure do |config|  | 
 | 54 | +# config.before(:each, js: true) do  | 
 | 55 | +# page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage)  | 
 | 56 | +# end  | 
 | 57 | +# end  | 
 | 58 | +# Capybara.javascript_driver = :selenium  | 
 | 59 | + | 
 | 60 | +Capybara.register_driver :poltergeist do |app|  | 
 | 61 | + Capybara::Poltergeist::Driver.new(app, {  | 
 | 62 | + js_errors: true,  | 
 | 63 | + timeout: 80,  | 
 | 64 | + debug: true,  | 
 | 65 | + :phantomjs_options => ['--debug=no', '--load-images=no']  | 
 | 66 | + })  | 
 | 67 | +end  | 
 | 68 | +Capybara.javascript_driver = :poltergeist  | 
0 commit comments