spec/integration/cassanity/migration_spec.rb in cassanity-0.5.1 vs spec/integration/cassanity/migration_spec.rb in cassanity-0.6.0.beta1
- old
+ new
@@ -1,10 +1,10 @@
require 'helper'
require 'cassanity/migrator'
describe Cassanity::Migration do
- let(:client) { Cassanity::Client.new(CassanityServers) }
+ let(:client) { Cassanity::Client.new(CassanityHost, CassanityPort) }
let(:driver) { client.driver }
let(:keyspace) { client[:cassanity_test] }
let(:migrator) { Cassanity::Migrator.new(keyspace, '/fake') }
let(:migration) { Class.new(described_class).new(migrator) }
@@ -125,12 +125,12 @@
migration.add_index :users, :email, name: :users_email_index
end
it "adds index" do
- meta = driver.schema.column_families['users'].column_metadata
- index = meta.detect { |c| c.index_name == 'users_email_index' }
+ columns = driver.execute("SELECT * from system.schema_columns WHERE keyspace_name='#{driver.keyspace}' AND columnfamily_name='users' ALLOW FILTERING")
+ index = columns.detect { |c| c['index_name'] == 'users_email_index' }
index.should_not be_nil
end
end
describe "#drop_index" do
@@ -147,11 +147,11 @@
migration.drop_index :users, :users_email_index
end
it "drops index" do
- meta = driver.schema.column_families['users'].column_metadata
- index = meta.detect { |c| c.index_name == 'users_email_index' }
+ columns = driver.execute("SELECT * from system.schema_columns WHERE keyspace_name='#{driver.keyspace}' AND columnfamily_name='users' ALLOW FILTERING")
+ index = columns.detect { |c| c['index_name'] == 'users_email_index' }
index.should be_nil
end
end
end