Sha256: 8cc2717172c779898932b8e42b8ff31732da434a319a4a929ed22f38b307eb51

Contents?: true

Size: 628 Bytes

Versions: 5

Compression:

Stored size: 628 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'active_record'

module SetupActiveRecord
  # Connection
  ar_config = { :test => { :adapter => 'sqlite3', :database => ":memory:" } }
  ActiveRecord::Base.configurations = ar_config
  ActiveRecord::Base.
    establish_connection(ActiveRecord::Base.configurations[:test])

  # Schema
  ActiveRecord::Schema.define do
    create_table :posts, :force => true do |t|
      t.string :title
      t.timestamps
    end
    create_table :users, :force => true do |t|
      t.string :name
    end
  end

  # Models
  class ::User < ActiveRecord::Base; end
  class ::Post < ActiveRecord::Base; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
untied-publisher-0.0.7.pre3 spec/support/setup_ar_and_schema.rb
untied-publisher-0.0.7.pre2 spec/support/setup_ar_and_schema.rb
untied-publisher-0.0.7.pre1 spec/support/setup_ar_and_schema.rb
untied-publisher-0.0.7.pre spec/support/setup_ar_and_schema.rb
untied-publisher-0.0.6 spec/support/setup_ar_and_schema.rb