Sha256: e02fcfc5a8f2d2a46b0239a2851cb96f94ae6d4ec25ba24e4c0169e3fc1d471a

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

require "simplecov"
require "oj"

SimpleCov.start

require "elasticity"

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

3 entries across 3 versions & 1 rubygems

Version Path
es-elasticity-0.8.0 spec/rspec_config.rb
es-elasticity-0.7.1 spec/rspec_config.rb
es-elasticity-0.7.0 spec/rspec_config.rb