Sha256: 23628bb2a9037d2554c36ffb14fe916d984ff9032574197c937ff6bb8a89a712

Contents?: true

Size: 991 Bytes

Versions: 7

Compression:

Stored size: 991 Bytes

Contents

begin
  # sqlite?
  ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
rescue Gem::LoadError
  # pg?
  if ENV['TRAVIS']
    ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test', :username => 'postgres')
  else
    ActiveRecord::Base.establish_connection(:adapter => 'postgresql', :database => 'active_type_test')
  end

  connection = ::ActiveRecord::Base.connection
  connection.tables.each do |table|
    connection.drop_table table
  end
end

ActiveRecord::Migration.class_eval do

  create_table :records do |t|
    t.string :persisted_string
    t.integer :persisted_integer
    t.datetime :persisted_time
    t.date :persisted_date
    t.boolean :persisted_boolean
  end

  create_table :children do |t|
    t.integer :record_id
  end

  create_table :sti_records do |t|
    t.string :persisted_string
    t.string :type
  end

  create_table :other_records do |t|
    t.string :other_string
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active_type-0.4.2 spec/support/database.rb
active_type-0.4.1 spec/support/database.rb
active_type-0.4.0 spec/support/database.rb
active_type-0.3.5 spec/support/database.rb
active_type-0.3.4 spec/support/database.rb
active_type-0.3.3 spec/support/database.rb
active_type-0.3.2 spec/support/database.rb