Sha256: 3464b819ea761f4016655cd3a7016e0085f444ffb9d33f13f02e42fe1987ca49

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path('spec_helper.rb', File.dirname(__FILE__))
include CassandraCQL

describe "Schema class" do
  before(:each) do
    @connection = setup_cassandra_connection
    @connection.execute("USE system")
  end

  context "initialize" do
    it "should set a thrift schema object" do
      @connection.schema.schema.should be_kind_of(CassandraCQL::Thrift::KsDef)
    end

    it "should set column family hash" do
      @connection.schema.column_families.should be_kind_of(Hash)
    end

    it "should set column family hash" do
      @connection.schema.column_families.should be_kind_of(Hash)
    end
  end

  it "should method_missing" do
    expect {
      @connection.schema.this_method_does_not_exist
    }.to raise_error NoMethodError
  end

  context "name" do
    it "should return keyspace name" do
      @connection.schema.name.should eq('system')
    end
  end

  context "to_s" do
    it "should return keyspace name" do
      @connection.schema.to_s.should eq(@connection.schema.name)
    end
  end

  context "column_family_names" do
    it "should return cf_def names" do
      @connection.schema.column_family_names.sort.should eq(@connection.schema.schema.cf_defs.map(&:name).sort)
    end
    
    it "should be the same as tables" do
      @connection.schema.column_family_names.should eq(@connection.schema.tables)
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
cassandra-cql-1.2.2 spec/schema_spec.rb
cassandra-cql-1.2.1 spec/schema_spec.rb
cassandra-cql-1.2.0 spec/schema_spec.rb
cassandra-cql-1.1.5 spec/schema_spec.rb
cassandra-cql-1.1.4 spec/schema_spec.rb
cassandra-cql-1.1.3 spec/schema_spec.rb
cassandra-cql-1.1.2 spec/schema_spec.rb
cassandra-cql-1.1.1 spec/schema_spec.rb
cassandra-cql-1.1.0 spec/schema_spec.rb
hallelujah-cassandra-cql-1.0.4 spec/schema_spec.rb
cassandra-cql-1.0.4 spec/schema_spec.rb
cassandra-cql-1.0.2 spec/schema_spec.rb
cassandra-cql-1.0.1 spec/schema_spec.rb