Sha256: b1dabec058467686623578069396e3dbb94816f39c677651b87fbaf11b55fd26

Contents?: true

Size: 845 Bytes

Versions: 4

Compression:

Stored size: 845 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.
        statements.
        must_equal([
          "rename table `origin` to `#{ @migration.archive_name }`, " +
          "`destination` to `origin`"
        ])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lhm-2.1.0 spec/unit/atomic_switcher_spec.rb
lhm-2.0.0 spec/unit/atomic_switcher_spec.rb
lhm-1.3.0 spec/unit/atomic_switcher_spec.rb
lhm-1.2.0 spec/unit/atomic_switcher_spec.rb