module Elasticsearch::Embedded::RSpec::ElasticSearchHelpers
Public Class Methods
memoized_cluster()
click to toggle source
Return a singleton instance of cluster object
# File lib/elasticsearch/embedded/rspec_configuration.rb, line 29 def memoized_cluster @cluster ||= ::Elasticsearch::Embedded::Cluster.new end
Public Instance Methods
client()
click to toggle source
Return a client connected to the configured client, if ::Elasticsearch::Client is defined return a client, else return a URI attached to cluster. @see ruby-doc.org/stdlib-2.1.2/libdoc/net/http/rdoc/Net/HTTP.html @see github.com/elasticsearch/elasticsearch-ruby
# File lib/elasticsearch/embedded/rspec_configuration.rb, line 11 def client @client ||= case when defined?(::Elasticsearch::Client) ::Elasticsearch::Client.new host: "localhost:#{cluster.port}" else URI("http://localhost:#{cluster.port}/") end end
cluster()
click to toggle source
Return a cluster instance to be used in tests
# File lib/elasticsearch/embedded/rspec_configuration.rb, line 22 def cluster ElasticSearchHelpers.memoized_cluster end