Sha256: 77871f8ddf81a95cb5baf855bee4683c781cbeb73cdc1c47115152c12648adbc

Contents?: true

Size: 931 Bytes

Versions: 8

Compression:

Stored size: 931 Bytes

Contents

require "simplecov"
require "oj"

SimpleCov.start

require "elasticity"
require "pry"
require "byebug"

def elastic_search_client
  return @elastic_search_client if defined?(@elastic_search_client)
  @elastic_search_client = Elasticsearch::Client.new host: "http://0.0.0.0:9200"
end

logger = Logger.new("spec/spec.log")
logger.level = Logger::DEBUG

ActiveSupport::LogSubscriber.logger = logger
Elasticity::LogSubscriber.attach_to(:elasticity)

RSpec.configure do |c|
  c.disable_monkey_patching!

  c.before(:suite) do
    logger.info "init.rspec Starting test suite execution"
  end

  c.before(:each) do |example|
    logger.info "spec.rspec #{example.full_description}"

    if example.metadata[:elasticsearch]
      client = elastic_search_client
    else
      client = double(:elasticsearch_client)
    end

    Elasticity.configure do |e|
      e.client    = client
      e.namespace = "elasticity_test"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
es-elasticity-0.12.0 spec/rspec_config.rb
es-elasticity-0.11.5 spec/rspec_config.rb
es-elasticity-0.11.1 spec/rspec_config.rb
es-elasticity-0.9.0 spec/rspec_config.rb
es-elasticity-0.8.4 spec/rspec_config.rb
es-elasticity-0.8.3 spec/rspec_config.rb
es-elasticity-0.8.2 spec/rspec_config.rb
es-elasticity-0.8.1 spec/rspec_config.rb