Sha256: eef4f36e9bf95d79d85a052192a75acbb91ee3ed4d20fdef9534f7ac1b1e4b04

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

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

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

describe Lhm::Table do
  include IntegrationHelper

  describe Lhm::Table::Parser do
    describe 'create table parsing' do
      before(:each) do
        connect_master!
        @table = table_create(:users)
      end

      it 'should parse table name in show create table' do
        @table.name.must_equal('users')
      end

      it 'should parse primary key' do
        @table.pk.must_equal('id')
      end

      it 'should parse column type in show create table' do
        @table.columns['username'][:type].must_equal('varchar(255)')
      end

      it 'should parse column metadata' do
        @table.columns['username'][:column_default].must_equal nil
      end

      it 'should parse indices' do
        @table.
          indices['index_users_on_username_and_created_at'].
          must_equal(['username', 'created_at'])
      end

      it 'should parse index' do
        @table.
          indices['index_users_on_reference'].
          must_equal(['reference'])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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