Skip to content

Instantly share code, notes, and snippets.

@aldesantis
Created January 10, 2016 14:24
Show Gist options
  • Save aldesantis/e1e5c6b46d3f0f0c4972 to your computer and use it in GitHub Desktop.
Save aldesantis/e1e5c6b46d3f0f0c4972 to your computer and use it in GitHub Desktop.
ENV['RAILS_ENV'] ||= 'test'
ENGINE_ROOT = File.join(File.dirname(__FILE__), '../')
# Load environment.rb from the dummy app.
require File.expand_path('../dummy/config/environment', __FILE__)
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
# Load RSpec helpers.
Dir[File.join(ENGINE_ROOT, 'spec/support/**/*.rb')].each { |f| require f }
# Load migrations from the dummy app.
ActiveRecord::Migrator.migrations_paths = File.join(ENGINE_ROOT, 'spec/dummy/db/migrate')
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.infer_spec_type_from_file_location!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment