Sha256: fe38e1af6d9d331bd1740bbdeffd9e9e47f383bee141378c433fa44b5a438a46

Contents?: true

Size: 952 Bytes

Versions: 26

Compression:

Stored size: 952 Bytes

Contents

require "codeclimate-test-reporter"
require "simplecov"
require "oj"

CodeClimate::TestReporter.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

26 entries across 26 versions & 1 rubygems

Version Path
es-elasticity-0.3.5 spec/rspec_config.rb
es-elasticity-0.3.4 spec/rspec_config.rb
es-elasticity-0.3.3 spec/rspec_config.rb
es-elasticity-0.3.2 spec/rspec_config.rb
es-elasticity-0.3.1 spec/rspec_config.rb
es-elasticity-0.3.0 spec/rspec_config.rb