Sha256: 7733a0fee89f0754ef69a6f58f5ba708bb011a0b1b632e777dd887a313c82e40
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/entangler' describe Lhm::Entangler do include IntegrationHelper before(:each) { connect_master! } describe 'entanglement' do before(:each) do @origin = table_create('origin') @destination = table_create('destination') @migration = Lhm::Migration.new(@origin, @destination) @entangler = Lhm::Entangler.new(@migration, connection) end it 'should replay inserts from origin into destination' do @entangler.run do execute("insert into origin (common) values ('inserted')") end slave do count(:destination, 'common', 'inserted').must_equal(1) end end it 'should replay deletes from origin into destination' do execute("insert into origin (common) values ('inserted')") @entangler.run do execute("delete from origin where common = 'inserted'") end slave do count(:destination, 'common', 'inserted').must_equal(0) end end it 'should replay updates from origin into destination' do @entangler.run do execute("insert into origin (common) values ('inserted')") execute("update origin set common = 'updated'") end slave do count(:destination, 'common', 'updated').must_equal(1) end end it 'should remove entanglement' do @entangler.run {} execute("insert into origin (common) values ('inserted')") slave do count(:destination, 'common', 'inserted').must_equal(0) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lhm-shopify-3.4.0 | spec/integration/entangler_spec.rb |
lhm-shopify-3.3.6 | spec/integration/entangler_spec.rb |
lhm-shopify-3.3.5 | spec/integration/entangler_spec.rb |