Sha256: f844d6fa41c35ebcdfecab77f68a865ca1b2356c69a5417d990660a9b2e6f2ad

Contents?: true

Size: 981 Bytes

Versions: 4

Compression:

Stored size: 981 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'

describe Lhm::Table do
  include UnitHelper

  describe "names" do
    it "should name destination" do
      @table = Lhm::Table.new("users")
      @table.destination_name.must_equal "lhmn_users"
    end
  end

  describe "constraints" do
    it "should be satisfied with a single column primary key called id" do
      @table = Lhm::Table.new("table", "id")
      @table.satisfies_primary_key?.must_equal true
    end

    it "should not be satisfied with a primary key unless called id" do
      @table = Lhm::Table.new("table", "uuid")
      @table.satisfies_primary_key?.must_equal false
    end

    it "should not be satisfied with multicolumn primary key" do
      @table = Lhm::Table.new("table", ["id", "secondary"])
      @table.satisfies_primary_key?.must_equal false
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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