Sha256: 50223555a436eb01e675300f75b233094e921c3303f48fe99800590f936610a2

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

require 'rubygems'
require 'bundler/setup'

ENV['RACK_ENV'] = 'test'

require 'slavery'

ActiveRecord::Base.configurations = {
  'test' =>            { adapter: 'sqlite3', database: 'test_db' },
  'test_slave'     =>  { adapter: 'sqlite3', database: 'test_slave_db' },
  'test_slave_url' => "postgres://root:@localhost:5432/test_slave"
}

# Prepare databases
class User < ActiveRecord::Base
end

# Create two records on master
ActiveRecord::Base.establish_connection(:test)
ActiveRecord::Base.connection.create_table :users, force: true
User.create
User.create

# Create one record on slave, emulating replication lag
ActiveRecord::Base.establish_connection(:test_slave)
ActiveRecord::Base.connection.create_table :users, force: true
User.create

# Reconnect to master
ActiveRecord::Base.establish_connection(:test)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slavery-2.1.0 spec/spec_helper.rb