spec/integration/entangler_spec.rb in lhm-1.0.0.rc2 vs spec/integration/entangler_spec.rb in lhm-1.0.0.rc3

- old
+ new

@@ -1,20 +1,18 @@ -# -# Copyright (c) 2011, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias -# Schmidt -# +# Copyright (c) 2011, 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! } + before(:each) { connect_master! } describe "entanglement" do before(:each) do @origin = table_create("origin") @destination = table_create("destination") @@ -25,36 +23,44 @@ it "should replay inserts from origin into destination" do @entangler.run do |entangler| execute("insert into origin (common) values ('inserted')") end - count(:destination, "common", "inserted").must_equal(1) + 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 |entangler| execute("delete from origin where common = 'inserted'") end - count(:destination, "common", "inserted").must_equal(0) + slave do + count(:destination, "common", "inserted").must_equal(0) + end end it "should replay updates from origin into destination" do @entangler.run do |entangler| execute("insert into origin (common) values ('inserted')") execute("update origin set common = 'updated'") end - count(:destination, "common", "updated").must_equal(1) + 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')") - count(:destination, "common", "inserted").must_equal(0) + + slave do + count(:destination, "common", "inserted").must_equal(0) + end end end end -