Permalink
Browse files

Merge pull request #176 from brainopia/master

By default Cassandra#drop_keyspace should use current keyspace
  • Loading branch information...
2 parents 936dc20 + 3c274dc commit ea96e7058f398796197ce09311eefdd6934e9e64 @natemueller natemueller committed Feb 15, 2013
Showing with 19 additions and 1 deletion.
  1. +1 −1 lib/cassandra/cassandra.rb
  2. +18 −0 test/cassandra_test.rb
@@ -353,7 +353,7 @@ def add_keyspace(ks_def)
#
# Returns the new schema id.
#
- def drop_keyspace(keyspace)
+ def drop_keyspace(keyspace=@keyspace)
return false if Cassandra.VERSION.to_f < 0.7
begin
View
@@ -1327,6 +1327,24 @@ def test_supercolumn_timestamps
assert(columns.timestamps[@uuids[1]] / 1000000 >= base_time.to_i)
end
+ def test_keyspace_operations
+ system = Cassandra.new 'system'
+ keyspace_name = 'robots'
+ keyspace_definition = Cassandra::Keyspace.new :name => keyspace_name,
+ :strategy_class => 'SimpleStrategy',
+ :strategy_options => { 'replication_factor' => '2' },
+ :cf_defs => []
+ system.add_keyspace keyspace_definition
+ assert system.keyspaces.any? {|it| it == keyspace_name }
+
+ system.drop_keyspace keyspace_name
+ assert system.keyspaces.none? {|it| it == keyspace_name }
+
+ system.add_keyspace keyspace_definition
+ Cassandra.new(keyspace_name).drop_keyspace
+ assert system.keyspaces.none? {|it| it == keyspace_name }
+ end
+
private
def key

0 comments on commit ea96e70

Please sign in to comment.