Sha256: 8a47cba974c7b747a90d221eb43c1bdc5f388574a5adfc5fda1ace1522020cf0

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

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

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 & 2 rubygems

Version Path
sbader-lhm-1.1.0 spec/unit/table_spec.rb
lhm-1.1.0 spec/unit/table_spec.rb
lhm-1.0.3 spec/unit/table_spec.rb
lhm-1.0.2 spec/unit/table_spec.rb