Sha256: d7c1d31d5306ce4b6400ed1c126f223d145ef6bf3bf45be003f61c12db9a2ba3

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

require File.expand_path(File.dirname(__FILE__)) + '/integration_helper'
require 'lhm/migration'

describe Lhm::ChunkInsert do
  include IntegrationHelper

  describe 'insert_and_return_count_of_rows_created' do
    before(:each) do
      connect_master!
      @origin = table_create(:origin)
      @destination = table_create(:destination)
      @migration = Lhm::Migration.new(@origin, @destination)
      execute("insert into origin set id = 1001")
      @instance = Lhm::ChunkInsert.new(@migration, connection, 1001, 1001)
    end

    it "returns the count" do
      assert_equal 1, @instance.insert_and_return_count_of_rows_created
    end

    it "inserts the record into the slave" do
      @instance.insert_and_return_count_of_rows_created

      slave do
        value(count_all(@destination.name)).must_equal(1)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lhm-shopify-3.5.0 spec/integration/chunk_insert_spec.rb
lhm-shopify-3.4.2 spec/integration/chunk_insert_spec.rb
lhm-shopify-3.4.1 spec/integration/chunk_insert_spec.rb