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

Version Path
superstore-1.2.0 test/support/cassandra.rb
superstore-1.1.4 test/support/cassandra.rb
superstore-1.1.3 test/support/cassandra.rb
superstore-1.1.2 test/support/cassandra.rb
superstore-1.1.1 test/support/cassandra.rb
superstore-1.1.0 test/support/cassandra.rb
superstore-1.0.12 test/support/cassandra.rb
superstore-1.0.11 test/support/cassandra.rb
superstore-1.0.10 test/support/cassandra.rb
superstore-1.0.9 test/support/cassandra.rb
superstore-1.0.8 test/support/cassandra.rb
superstore-1.0.7 test/support/cassandra.rb
superstore-1.0.6 test/support/cassandra.rb
superstore-1.0.5 test/support/cassandra.rb
superstore-1.0.4 test/support/cassandra.rb
superstore-1.0.3 test/support/cassandra.rb
superstore-1.0.2 test/support/cassandra.rb