Permalink
Browse files

Add test for create_index_clause

  • Loading branch information...
1 parent 6c80a22 commit b998bf8b7b99bb1a7fae17eafc5ac991142d8190 @mcmire committed Aug 6, 2012
Showing with 21 additions and 0 deletions.
  1. +21 −0 test/cassandra_test.rb
View
21 test/cassandra_test.rb
@@ -962,6 +962,27 @@ def test_get_indexed_slices_with_IndexClause_objects
# <- can't test which keys are present since it's going to be random
end
+ def test_create_index_clause
+ ie = CassandraThrift::IndexExpression.new(
+ :column_name => 'foo',
+ :value => 'x',
+ :op => '=='
+ )
+
+ ic = @twitter.create_index_clause([ie], 'aaa', 250)
+ assert_instance_of CassandraThrift::IndexClause, ic
+ assert_equal 'aaa', ic.start_key
+ assert_equal ie, ic.expressions[0]
+ assert_equal 250, ic.count
+
+ # test alias
+ ic = @twitter.create_idx_clause([ie], 'aaa', 250)
+ assert_instance_of CassandraThrift::IndexClause, ic
+ assert_equal 'aaa', ic.start_key
+ assert_equal ie, ic.expressions[0]
+ assert_equal 250, ic.count
+ end
+
def test_column_family_mutation
k = key

0 comments on commit b998bf8

Please sign in to comment.