Skip to content

Commit

Permalink
added intersection specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rany Keddo committed Jan 16, 2012
1 parent 4c4f47f commit a7e6d17
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions spec/unit/intersection_spec.rb
@@ -0,0 +1,42 @@
#
# 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/migrator'

describe Lhm::Intersection do
include UnitHelper

it "should not have dropped changes" do
origin = Lhm::Table.new("origin")
origin.columns["dropped"] = varchar
origin.columns["retained"] = varchar

destination = Lhm::Table.new("destination")
destination.columns["retained"] = varchar

intersection = Lhm::Intersection.new(origin, destination)
intersection.common.include?("dropped").must_equal(false)
end

it "should have unchanged columns" do
origin = Lhm::Table.new("origin")
origin.columns["dropped"] = varchar
origin.columns["retained"] = varchar

destination = Lhm::Table.new("destination")
destination.columns["retained"] = varchar

intersection = Lhm::Intersection.new(origin, destination)
intersection.common.must_equal(["retained"])
end

def varchar
{ :metadata => "VARCHAR(255)"}
end
end

0 comments on commit a7e6d17

Please sign in to comment.