Sha256: 9326a6aeab78215aa630b3148775d805c886ec81129135d5b547667e9b5879be

Contents?: true

Size: 1.59 KB

Versions: 18

Compression:

Stored size: 1.59 KB

Contents

require 'test_helper'

class Superstore::CassandraSchema::StatementsTest < Superstore::TestCase
  if Superstore::Base.adapter.is_a?(Superstore::Adapters::CassandraAdapter)
    test "create_keyspace" do
      Superstore::CassandraSchema.create_keyspace 'Blah'

      existing_keyspace = false
      begin
        Superstore::CassandraSchema.create_keyspace 'Blah'
      rescue Exception => e
        existing_keyspace = true
      ensure
        Superstore::CassandraSchema.drop_keyspace 'Blah'
      end

      assert existing_keyspace
    end

    test "add_index" do
      begin
        Superstore::CassandraSchema.create_table 'TestIndexed'
        Superstore::CassandraSchema.alter_column_family 'TestIndexed', "ADD id_value varchar"
        Superstore::CassandraSchema.add_index 'TestIndexed', 'id_value'
      ensure
        Superstore::CassandraSchema.drop_table 'TestIndexed'
      end
    end

    test "drop_index" do
      begin
        Superstore::CassandraSchema.create_table 'TestDropIndexes'

        Superstore::CassandraSchema.alter_column_family 'TestDropIndexes', "ADD id_value1 varchar"
        Superstore::CassandraSchema.alter_column_family 'TestDropIndexes', "ADD id_value2 varchar"

        Superstore::CassandraSchema.add_index 'TestDropIndexes', 'id_value1'
        Superstore::CassandraSchema.add_index 'TestDropIndexes', 'id_value2', 'special_name'

        Superstore::CassandraSchema.drop_index 'TestDropIndexes_id_value1_idx'
        Superstore::CassandraSchema.drop_index 'special_name'
      ensure
        Superstore::CassandraSchema.drop_table 'TestDropIndexes'
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
superstore-1.2.0 test/unit/cassandra_schema/statements_test.rb
superstore-1.1.4 test/unit/cassandra_schema/statements_test.rb
superstore-1.1.3 test/unit/cassandra_schema/statements_test.rb
superstore-1.1.2 test/unit/cassandra_schema/statements_test.rb
superstore-1.1.1 test/unit/cassandra_schema/statements_test.rb
superstore-1.1.0 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.12 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.11 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.10 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.9 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.8 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.7 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.6 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.5 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.4 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.3 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.2 test/unit/cassandra_schema/statements_test.rb
superstore-1.0.0 test/unit/cassandra_schema/statements_test.rb