Sha256: 710480a19dea2b7af0c9092bec80e9f60bd2593447019497df26e57ff95cd626

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

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

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

require 'lhm/table'
require 'lhm/migration'
require 'lhm/locked_switcher'

describe Lhm::LockedSwitcher do
  include IntegrationHelper

  before(:each) { connect! }

  describe "switching" do
    before(:each) do
      @origin = table_create("origin")
      @destination = table_create("destination")
      @migration = Lhm::Migration.new(@origin, @destination)
    end

    it "rename origin to archive" do
      switcher = Lhm::LockedSwitcher.new(@migration, connection)
      switcher.run

      table_exists?(@origin).must_equal true
      table_read(@migration.archive_name).columns.keys.must_include "origin"
    end

    it "rename destination to origin" do
      switcher = Lhm::LockedSwitcher.new(@migration, connection)
      switcher.run

      table_exists?(@destination).must_equal false
      table_read(@origin.name).columns.keys.must_include "destination"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lhm-1.0.0.rc2 spec/integration/locked_switcher_spec.rb
lhm-1.0.0.rc.1 spec/integration/locked_switcher_spec.rb