Sha256: ae770729cff7e5152403ac1a58d08132d889cfcf21bf310399a5b5c3e2a5c399

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

$:.unshift(File.expand_path('../../lib', __FILE__))
$:.unshift(File.expand_path('../', __FILE__))

require 'rubygems'
require 'bundler'
require 'logger'
require 'pathname'

Bundler.require(:default, :test)

require 'adapter/spec/an_adapter'
require 'adapter-cassanity'

log_path = Pathname(__FILE__).join('..', '..', 'log').expand_path
log_path.mkpath

logger = Logger.new(log_path.join('test.log'))

COLUMN_FAMILIES = {}

cassandra_setup = lambda { |args|
  host          = ENV.fetch('CASSANDRA_HOST', '127.0.0.1')
  port          = ENV.fetch('CASSANDRA_PORT', '9042').to_i
  keyspace_name = ENV.fetch('CASSANDRA_KEYSPACE_NAME', 'adapter_cassanity')
  client        = Cassanity::Client.new([host], port)
  keyspace      = client.keyspace(keyspace_name)
  keyspace.recreate

  COLUMN_FAMILIES[:single] = keyspace.column_family(:single, {
    schema: Cassanity::Schema.new({
      primary_key: :some_key,
      columns: {
        some_key: :text,
        one: :text,
        two: :text,
        three: :text,
        four: :text,
      }
    }),
  })

  COLUMN_FAMILIES[:single].create
}

RSpec.configure do |config|
  config.before :suite, &cassandra_setup
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adapter-cassanity-0.6.0.beta1 spec/helper.rb