Sha256: 67818a3e0974afe08b0c3a53eb002ccdebcea01722b762492fc1ceb9d4df4920

Contents?: true

Size: 829 Bytes

Versions: 10

Compression:

Stored size: 829 Bytes

Contents

# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias
# Schmidt

require File.expand_path(File.dirname(__FILE__)) + '/unit_helper'

require 'lhm/table'
require 'lhm/migration'
require 'lhm/atomic_switcher'

describe Lhm::AtomicSwitcher do
  include UnitHelper

  before(:each) do
    @start       = Time.now
    @origin      = Lhm::Table.new('origin')
    @destination = Lhm::Table.new('destination')
    @migration   = Lhm::Migration.new(@origin, @destination, @start)
    @switcher    = Lhm::AtomicSwitcher.new(@migration, nil)
  end

  describe 'atomic switch' do
    it 'should perform a single atomic rename' do
      value(@switcher.atomic_switch).must_equal(
        "RENAME TABLE `origin` TO `#{ @migration.archive_name }`, " \
        '`destination` TO `origin`'
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
lhm-shopify-4.4.2 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.4.1 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.4.0 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.3.0 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.2.3 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.2.2 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.2.1 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.2.0 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.1.1 spec/unit/atomic_switcher_spec.rb
lhm-shopify-4.1.0 spec/unit/atomic_switcher_spec.rb