Sha256: 08745edf95085ddb0914ce70e983555c7512335827c31a22ff937b92d3c579fd
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
CassandraObject::Base.config = { keyspace: 'cassandra_object_test', servers: '127.0.0.1:9160', thrift: { timeout: 5 } } begin CassandraObject::Schema.drop_keyspace 'cassandra_object_test' rescue Exception => e end sleep 1 CassandraObject::Schema.create_keyspace 'cassandra_object_test' CassandraObject::Schema.create_column_family 'Issues' CassandraObject::Base.adapter.consistency = 'QUORUM' CassandraObject::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 CassandraObject::Base.created_records.any? CassandraObject::Base.delete_after_test end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gotime-cassandra_object-4.12.2 | test/support/cassandra.rb |
gotime-cassandra_object-4.12.1 | test/support/cassandra.rb |