Sha256: 96b9531efe2c33c8e168d0f5d91acc95fd53a78a40997cc494694b2f8230e099

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

require "rubygems"

require "active_model"

require_relative "../lib/whi-cassie"

require_relative "models/thing"
require_relative "models/type_tester"

RSpec.configure do |config|
  config.run_all_when_everything_filtered = true
  config.filter_run :focus

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = "random"

  config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }

  cassandra_host, cassandra_port = ENV.fetch("CASSANDRA_HOST", "localhost").split(":", 2)
  cassandra_port ||= 9042
  config.before(:suite) do
    schema_dir = File.expand_path("../schema", __FILE__)
    protocol_version = (ENV["protocol_version"] ? ENV["protocol_version"].to_i : 3)
    Cassie.configure!(
      cluster: {host: cassandra_host, port: cassandra_port.to_i, protocol_version: protocol_version},
      keyspaces: {"test" => "cassie_specs"},
      schema_directory: schema_dir,
      max_prepared_statements: 3
    )

    attempts = 0
    loop do
      begin
        Cassie::Schema.load_all!
        break
      rescue Cassandra::Errors::NoHostsAvailable => e
        attempts += 1
        raise e if attempts > 60
        sleep(1)
      end
    end

    Cassie::Testing.prepare!
  end

  config.after(:suite) do
    Cassie::Schema.drop_all!
  end

  config.around(:each) do |example|
    Cassie::Testing.cleanup! do
      example.run
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
whi-cassie-1.3.4 spec/spec_helper.rb
whi-cassie-1.3.2 spec/spec_helper.rb
whi-cassie-1.3.1 spec/spec_helper.rb
whi-cassie-1.3.0 spec/spec_helper.rb