Sha256: 51fcdff7b9db05b7d277835d4ecf7d4cb071358691a0283a3fff4f0a6e71e952

Contents?: true

Size: 1.32 KB

Versions: 13

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

RSpec.configure do |config|
  config.before(:all, :elasticsearch => lambda { |v| !!v }) do
    config.rspeckled_logger.debug("Before All   - Start - #{__FILE__}")

    ::Elasticsearch::Extensions::Test::Cluster.start(:port => 9200) unless ::Elasticsearch::Extensions::Test::Cluster.running?

    config.rspeckled_logger.debug("Before All   - End   - #{__FILE__}")
  end

  config.around(:each, :elasticsearch => lambda { |v| !!v }) do |example|
    config.rspeckled_logger.debug("Around Each  - Start - #{__FILE__}")

    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'

    config.rspeckled_logger.debug("Around Each  - End   - #{__FILE__}")
  end

  config.after(:all, :elasticsearch => lambda { |v| !!v }) do
    config.rspeckled_logger.debug("After  All   - Start - #{__FILE__}")

    ::Elasticsearch::Extensions::Test::Cluster.stop(:port => 9200) if ::Elasticsearch::Extensions::Test::Cluster.running?

    config.rspeckled_logger.debug("After  All   - End   - #{__FILE__}")
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rspeckled-2.0.1 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-2.0.0 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.4.0 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.3.1 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.3.0 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.2.1 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.2.0 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.1.3 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.1.2 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.1.1 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.1.0 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.0.5 lib/rspeckled/plugins/hooks/elasticsearch.rb
rspeckled-1.0.4 lib/rspeckled/plugins/hooks/elasticsearch.rb