Sha256: 3cdd4993e67e83dbd1a8f9e3ecdbb32fae0fda88769da0431fcd09d0071daec3

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

require 'spec_helper'

describe 'index schema dumper' do
  let!(:connection) { ActiveRecord::Base.connection }
  it 'correctly generates index statements' do
    connection.create_table :index_types do |t|
      t.integer :col1, :array => true
      t.integer :col2
    end
    connection.add_index(:index_types, :col1, :index_type => :gin)
    connection.add_index(:index_types, :col2, :where => '(col2 > 50)')

    stream = StringIO.new
    ActiveRecord::SchemaDumper.dump(connection, stream)
    output = stream.string

    output.should match /:index_type => :gin/
    output.should_not match /:index_type => :btree/
    output.should match /:where => "\(col2 > 50\)"/
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
postgres_ext-0.0.9 spec/schema_dumper/index_spec.rb