Sha256: 84920ca5da62b105a9669f648ba3546428569b262a98b1880eca8a64347c4366
Contents?: true
Size: 761 Bytes
Versions: 5
Compression:
Stored size: 761 Bytes
Contents
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'active_record' # database ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}} ActiveRecord::Base.establish_connection('test') # models class Post < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :post end #migrations class CreateAllTables < ActiveRecord::Migration def self.up create_table(:posts) {|t| t.string :title} create_table(:comments) {|t| t.text :body; t.references :post} end end RSpec.configure do |config| config.before :all do CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'posts' end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
everywhere-2.0.0 | spec/spec_helper.rb |
everywhere-1.0.1 | spec/spec_helper.rb |
everywhere-1.0.0 | spec/spec_helper.rb |
everywhere-0.1.0 | spec/spec_helper.rb |
everywhere-0.0.1 | spec/spec_helper.rb |