Sha256: 96090b4d35d2ba99b0de2ee5fe72262e6f29b9e0e3bda4de6fa7d9d7de1b7a88

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

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

3 entries across 3 versions & 1 rubygems

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