From 682d6dfa3ca84237c5eed354ec058594914c63db Mon Sep 17 00:00:00 2001 From: uu59 Date: Wed, 28 Jan 2015 18:04:19 +0900 Subject: [PATCH] Be data_dir under the tmp/ on test environment --- lib/fluentd-ui.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/fluentd-ui.rb b/lib/fluentd-ui.rb index 2810851..c3772b5 100644 --- a/lib/fluentd-ui.rb +++ b/lib/fluentd-ui.rb @@ -21,7 +21,11 @@ module FluentdUI end def self.data_dir - dir = ENV["FLUENTD_UI_DATA_DIR"].presence || ENV["HOME"] + "/.fluentd-ui/core_data" + if Rails.env.test? + dir = Rails.root.join("tmp", "core_data").to_s + else + dir = ENV["FLUENTD_UI_DATA_DIR"].presence || ENV["HOME"] + "/.fluentd-ui/core_data" + end FileUtils.mkdir_p(dir) # ensure directory exists dir end