Skip to content

Business intelligence made simple

Improved Cassandra test [skip ci]

Andrew Kaned2202c755cca
diff --git a/test/adapters/cassandra_test.rb b/test/adapters/cassandra_test.rb
index 417d2a55..00e84b35 100644
--- a/test/adapters/cassandra_test.rb
+++ b/test/adapters/cassandra_test.rb
@@ -1,9 +1,5 @@
require_relative "../test_helper"
-# CREATE KEYSPACE blazer_test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
-# USE blazer_test;
-# CREATE TABLE items (id int, name text, PRIMARY KEY (id));
-
class CassandraTest < ActionDispatch::IntegrationTest
include AdapterTest
@@ -11,6 +7,21 @@ class CassandraTest < ActionDispatch::IntegrationTest
"cassandra"
end
+ def setup
+ @@once ||= begin
+ require "cassandra"
+ cluster = Cassandra.cluster(hosts: ["localhost"])
+
+ session = cluster.connect("system")
+ session.execute("CREATE KEYSPACE IF NOT EXISTS blazer_test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }")
+
+ session = cluster.connect("blazer_test")
+ session.execute("DROP TABLE IF EXISTS items")
+ session.execute("CREATE TABLE items (id int, name text, PRIMARY KEY (id))")
+ true
+ end
+ end
+
def test_run
assert_result [{"count" => "0"}], "SELECT COUNT(*) FROM items"
end