Sha256: 0cd13d1f5d5428717b2f13936d6b2934b2634f5180019f7746b98b3b183c2bdf

Contents?: true

Size: 854 Bytes

Versions: 7

Compression:

Stored size: 854 Bytes

Contents

require "elasticity_base"
require "simplecov"
require "oj"
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", File::WRONLY | File::APPEND | File::CREAT)

RSpec.configure do |c|
  c.disable_monkey_patching!

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

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
es-elasticity-0.2.7 spec/rspec_config.rb
es-elasticity-0.2.6 spec/rspec_config.rb
es-elasticity-0.2.5 spec/rspec_config.rb
es-elasticity-0.2.4 spec/rspec_config.rb
es-elasticity-0.2.3 spec/rspec_config.rb
es-elasticity-0.2.2 spec/rspec_config.rb
es-elasticity-0.2.1 spec/rspec_config.rb