Sha256: db85ffcf222525f401df79cf91cb7994f188c97158b5185e4929bbf593ce6e1c

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8

describe "CREATE INDEX" do

  include QueryBuilder::CQL::Operators

  let(:table) { QueryBuilder::CQL.keyspace(:wildlife).table(:species) }

  it_behaves_like :query_builder do
    subject do
      table.index(:my_index)
        .create(:id, :priority)
        .add(:state)
        .if_not_exists
        .using("path.to.the.IndexClass")
        .with(storage: "/mnt/ssd/indexes/")
    end

    let(:cql) { "CREATE INDEX IF NOT EXISTS my_index ON wildlife.species ((id, priority), state) USING 'path.to.the.IndexClass' WITH options = {'storage': '/mnt/ssd/indexes/'};" }
  end

  it_behaves_like :query_builder do
    subject do
      table.index
        .create(:id, :priority)
        .add(:state)
        .if_not_exists
        .using("path.to.the.IndexClass")
        .with(storage: "/mnt/ssd/indexes/")
    end

    let(:cql) { "CREATE CUSTOM INDEX IF NOT EXISTS ON wildlife.species ((id, priority), state) USING 'path.to.the.IndexClass' WITH options = {'storage': '/mnt/ssd/indexes/'};" }
  end

end # describe CREATE INDEX

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
query_builder-0.0.4 spec/integration/create_index_spec.rb
query_builder-0.0.3 spec/integration/create_index_spec.rb
query_builder-0.0.2 spec/integration/create_index_spec.rb
query_builder-0.0.1 spec/integration/create_index_spec.rb