Last active
August 10, 2018 06:22
-
-
Save rowanoulton/fbf35e0e69097a0a502a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/spec_helper.rb | |
require 'elasticsearch/extensions/test/cluster' | |
RSpec.configure do |config| | |
# Start an in-memory cluster for Elasticsearch as needed | |
config.before :all, elasticsearch: true do | |
Elasticsearch::Extensions::Test::Cluster.start(port: 9250, nodes: 1, timeout: 120) unless Elasticsearch::Extensions::Test::Cluster.running?(on: 9250) | |
end | |
# Stop elasticsearch cluster after test run | |
config.after :suite do | |
Elasticsearch::Extensions::Test::Cluster.stop(port: 9250, nodes: 1) if Elasticsearch::Extensions::Test::Cluster.running?(on: 9250) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment