Sha256: 91cb8c7eac7d5760306b1b4b2212554b44db3f3e19cbbf9deeba2159767b4452

Contents?: true

Size: 981 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
lhm-2.2.0 spec/unit/table_spec.rb