Sha256: 40cd1cf015e03747bd8c66f472bcd92c732eb30f2101c2f4ab28e039a4bd5292
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
$LOAD_PATH.unshift(File.dirname(__FILE__)) ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../dummy/config/environment.rb', __FILE__) # nasty hacky catch of environment data wiped out by tests run in rails 4 via appraisal if ActiveRecord::VERSION::STRING >= '5.0' system('bin/rails dummy:db:environment:set RAILS_ENV=test') end require 'rspec/rails' require 'capybara/rails' require 'capybara/rspec' require 'database_cleaner' require 'factory_girl' require 'timecop' Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f } Rails.backtrace_cleaner.remove_silencers! DatabaseCleaner.strategy = :truncation # Load factory girl factories. Dir[File.join(File.dirname(__FILE__), 'factories/**/*.rb')].each { |f| require f } # Build test database in spec/dummy/db. There's probably a better way to do this. if defined?(ActiveRecord::Migration.maintain_test_schema!) ActiveRecord::Migration.maintain_test_schema! # rails 4.1+ else ActiveRecord::Migration.check_pending! # rails 4.0 end if ActiveRecord::VERSION::STRING >= '4.2' && ActiveRecord::VERSION::STRING < '5.0' ActiveRecord::Base.raise_in_transactional_callbacks = true end RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.infer_spec_type_from_file_location! config.order = :random config.use_transactional_fixtures = true config.expect_with :rspec do |expectations| expectations.syntax = :expect end config.mock_with :rspec do |mocks| mocks.syntax = :expect end config.after(:each, type: :feature) do DatabaseCleaner.clean # Truncate the database Capybara.reset_sessions! # Forget the (simulated) browser state Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authenticate-0.7.2 | spec/spec_helper.rb |