Created
January 13, 2016 08:41
-
-
Save bunnymatic/11fa0d5ac32a4e37be8c to your computer and use it in GitHub Desktop.
Revisions
-
bunnymatic created this gist
Jan 13, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ require_relative "../../spec/support/test_es_server" require_relative "./webmock" TestEsServer.start at_exit do TestEsServer.stop end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ require 'webmock/cucumber' WebMock.disable_net_connect!(:allow_localhost => true) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ require 'elasticsearch/extensions/test/cluster' class TestEsServer def self.cluster Elasticsearch::Extensions::Test::Cluster end def self.port @port ||= URI.parse(Rails.application.config.elasticsearch_url).port end def self.running? cluster.running?(on: port) end def self.start puts "Starting elastic search cluster on port #{port} if necessary" cluster.start(port: port, nodes: 1) unless running? end def self.stop puts "Tearing down elastic search cluster on port #{port} if necessary" cluster.stop(port: port) if running? end end