Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

By default Cassandra#drop_keyspace should use current keyspace #176

Merged
merged 1 commit into from

2 participants

@brainopia

No description provided.

@natemueller
Owner

Can you add a test?

@brainopia

Sure, here you go :)

@natemueller natemueller merged commit ea96e70 into cassandra-rb:master
@natemueller
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.