Sha256: eeb57549b1fd79289717dff9e1920da6c318d2ef7aba1152554c16fd5f74cede

Contents?: true

Size: 1.19 KB

Versions: 24

Compression:

Stored size: 1.19 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

24 entries across 24 versions & 1 rubygems

Version Path
rspeckled-0.0.54 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.53 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.52 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.51 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.50 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.49 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.48 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.47 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.46 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.45 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.44 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.43 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.42 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.41 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.40 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.39 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.38 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.37 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.36 lib/rspeckled/plugins/elasticsearch.rb
rspeckled-0.0.35 lib/rspeckled/plugins/elasticsearch.rb