Permalink
Browse files

By default drop_keyspace should use current keyspace

  • Loading branch information...
1 parent 936dc20 commit 3c274dca1ef7a55f3a4e968fbb250a151388c6ef @brainopia brainopia 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
View
2 lib/cassandra/cassandra.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
18 test/cassandra_test.rb
@@ -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 3c274dc

Please sign in to comment.