Sha256: ededb8bf90008d2a52027daec2c1c45da29c982c477a058dbb53cb1652c79033

Contents?: true

Size: 838 Bytes

Versions: 2

Compression:

Stored size: 838 Bytes

Contents

# Copyright (c) 2011, 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

2 entries across 2 versions & 2 rubygems

Version Path
sbader-lhm-1.1.0 spec/unit/atomic_switcher_spec.rb
lhm-1.1.0 spec/unit/atomic_switcher_spec.rb