Created
May 24, 2013 10:21
-
-
Save woods/5642596 to your computer and use it in GitHub Desktop.
Load just the models and lib of a Rails project. This can be useful for model/component/service specs that depend on ActiveRecord, but no other part of Rails. Running the tests in this fashion helps to make sure you don't introduce any other Rails dependencies into your code, and it helps those tests to load a few seconds faster since we're not …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/setup' | |
require 'active_support' | |
require 'active_support/dependencies' | |
ActiveSupport::Dependencies.autoload_paths += %w{ app/models lib } | |
require 'active_record' | |
db_config = YAML.load_file('config/database.yml') | |
ActiveRecord::Base.establish_connection(db_config['test']) | |
require 'carrierwave' | |
require 'carrierwave/orm/activerecord' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment