Sha256: 96e21fbdb144cd3c7be16579680af3b083b8c4a4926e57a4888be1bc453af46f

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require 'spec_helper'

describe 'UUID migrations' do
  let!(:connection) { ActiveRecord::Base.connection }
  it 'creates an uuid column' do
    lambda do
      connection.create_table :data_types do |t|
        t.uuid :uuid_1
        t.uuid :uuid_2, :uuid_3
        t.column :uuid_4, :uuid
      end
    end.should_not raise_exception

    columns = connection.columns(:data_types)
    uuid_1 = columns.detect { |c| c.name == 'uuid_1'}
    uuid_2 = columns.detect { |c| c.name == 'uuid_2'}
    uuid_3 = columns.detect { |c| c.name == 'uuid_3'}
    uuid_4 = columns.detect { |c| c.name == 'uuid_4'}

    uuid_1.sql_type.should eq 'uuid'
    uuid_2.sql_type.should eq 'uuid'
    uuid_3.sql_type.should eq 'uuid'
    uuid_4.sql_type.should eq 'uuid'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
postgres_ext-0.0.9 spec/migrations/uuid_spec.rb
postgres_ext-0.0.8 spec/migrations/uuid_spec.rb