From 5067ecd3ac85efb40ea48890a63c57e5a7da5bc5 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 1 Dec 2016 11:36:35 +0100 Subject: [PATCH] prevent elasticsearch from logging during tests (clearer output) --- config/initializers/elasticsearch.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/initializers/elasticsearch.rb b/config/initializers/elasticsearch.rb index 5f8f7d446..1e6b9966e 100644 --- a/config/initializers/elasticsearch.rb +++ b/config/initializers/elasticsearch.rb @@ -1,3 +1,8 @@ -client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200", log: true +if Rails.env.test? + client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200", log: false +else + client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200", log: true +end + Elasticsearch::Model.client = client Elasticsearch::Persistence.client = client