Sha256: 4559115089e127d5d70eecf31c8fe4affc244150bc9c44eb4cff39058f6049ca

Contents?: true

Size: 1.18 KB

Versions: 14

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true
##############################################################################
#                          Elasticsearch Plugin
##############################################################################

begin
  require 'elasticsearch-extensions'

  RSpec.configure do |config|
    config.before(:suite, :elasticsearch => lambda { |v| !!v }) do
      Elasticsearch::Extensions::Test::Cluster.start(:port => 9200) unless Elasticsearch::Extensions::Test::Cluster.running?
    end

    config.around(:each, :elasticsearch => lambda { |v| !!v }) do |example|
      model = case example.metadata[:elasticsearch]
              when String
                example.metadata[:elasticsearch].constantize
              end

      model.__elasticsearch__.client.indices.delete :index => '_all'
      model.__elasticsearch__.create_index!         :index => model.index_name

      example.run

      model.__elasticsearch__.client.indices.delete :index => '_all'
    end

    config.after(:suite, :elasticsearch => lambda { |v| !!v }) do
      Elasticsearch::Extensions::Test::Cluster.stop(:port => 9200) if Elasticsearch::Extensions::Test::Cluster.running?
    end
  end
rescue LoadError
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rspeckled-0.0.30 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.29 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.28 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.27 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.26 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.25 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.24 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.23 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.22 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.21 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.20 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.19 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.18 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.17 lib/rspeckled/plugins/elasticsearch.rb