Sha256: 548c750bbb9fe28dd993c58f48cc37b8fc6b2ce4ddb3ffc1686e243d23f7f53b
Contents?: true
Size: 1019 Bytes
Versions: 17
Compression:
Stored size: 1019 Bytes
Contents
Bundler.require :cassandra Superstore::Base.config = { keyspace: 'superstore_test', servers: '127.0.0.1:9160', consistency: 'QUORUM', thrift: { timeout: 5 } } begin Superstore::CassandraSchema.drop_keyspace 'superstore_test' rescue Exception => e end sleep 1 Superstore::CassandraSchema.create_keyspace 'superstore_test' Superstore::CassandraSchema.create_column_family 'Issues' Superstore::CassandraSchema.alter_column_family 'Issues', "ADD title varchar" Superstore::CassandraSchema.add_index 'Issues', 'title', "issues_title_idx" Superstore::Base.class_eval do class_attribute :created_records self.created_records = [] after_create do created_records << self end def self.delete_after_test # created_records.reject(&:destroyed?).each(&:destroy) Issue.delete_all created_records.clear end end module ActiveSupport class TestCase teardown do if Superstore::Base.created_records.any? Superstore::Base.delete_after_test end end end end
Version data entries
17 entries across 17 versions & 1 rubygems