Sha256: 04f556880df547fdb1cb5296068936312c3a73e255c7711cdcb6e273f37e0061

Contents?: true

Size: 740 Bytes

Versions: 1

Compression:

Stored size: 740 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' }
}

# 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.0.0 spec/spec_helper.rb