Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created October 14, 2011 13:19
Show Gist options
  • Select an option

  • Save makevoid/1287071 to your computer and use it in GitHub Desktop.

Select an option

Save makevoid/1287071 to your computer and use it in GitHub Desktop.
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)
end
end
# time rspec your_model_spec.rb => ~ 3sec
# time bacon your_model_spec.rb => ~ 1sec
@makevoid

Copy link
Copy Markdown
Author

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