Create a gist now

Instantly share code, notes, and snippets.

running model specs requiring active record
require 'active_record' # or older require "activerecord"
require_relative 'app/models/your_model'
ActiveRecord::Base.establish_connection(adapter: 'mysql', host: 'localhost', username: 'root', database: 'your_database')
describe "something" do
it "should spec somehting" do
YourModel.first.should be_a(YourModel)
# time rspec your_model_spec.rb => ~ 3sec
# time bacon your_model_spec.rb => ~ 1sec

tell me your thoughts about it! much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment