Sha256: a6a014147a2b1c3a189a3d5234f364c41a098573ac9de224ce6745a4f124ef6c

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 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
      @switcher.
        atomic_switch.
        must_equal(
          "rename table `origin` to `#{ @migration.archive_name }`, " \
          '`destination` to `origin`'
        )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lhm-shopify-3.4.0 spec/unit/atomic_switcher_spec.rb
lhm-shopify-3.3.6 spec/unit/atomic_switcher_spec.rb
lhm-shopify-3.3.5 spec/unit/atomic_switcher_spec.rb