Sha256: 64977c97762bc8d91f697a844652f3807d403179c0caa9fc6c8d7bca6bed63aa

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.1.0 spec/integration/table_spec.rb