From 4601fb4f3c90669d89632f8879e4ec5d3f759f02 Mon Sep 17 00:00:00 2001 From: Michael Hoy Date: Tue, 9 Apr 2019 10:38:46 -0400 Subject: [PATCH 1/2] fix for parallel spec tasks initializing in development --- lib/dotenv/rails.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dotenv/rails.rb b/lib/dotenv/rails.rb index 5a733df4..b5d5db6d 100644 --- a/lib/dotenv/rails.rb +++ b/lib/dotenv/rails.rb @@ -9,7 +9,7 @@ # # See https://github.com/bkeepers/dotenv/issues/219 if defined?(Rake.application) - is_running_specs = Rake.application.top_level_tasks.grep(/^spec(:|$)/).any? + is_running_specs = Rake.application.top_level_tasks.grep(/^(parallel:spec|spec(:|$))/).any? Rails.env = ENV["RAILS_ENV"] ||= "test" if is_running_specs end From 5921eff87236e5bf71892ae7f7d26c4cf5fee772 Mon Sep 17 00:00:00 2001 From: Michael Hoy Date: Sun, 16 Jun 2019 09:23:21 -0400 Subject: [PATCH 2/2] reduce line length --- lib/dotenv/rails.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dotenv/rails.rb b/lib/dotenv/rails.rb index b5d5db6d..3ddc241a 100644 --- a/lib/dotenv/rails.rb +++ b/lib/dotenv/rails.rb @@ -9,8 +9,9 @@ # # See https://github.com/bkeepers/dotenv/issues/219 if defined?(Rake.application) - is_running_specs = Rake.application.top_level_tasks.grep(/^(parallel:spec|spec(:|$))/).any? - Rails.env = ENV["RAILS_ENV"] ||= "test" if is_running_specs + if Rake.application.top_level_tasks.grep(/^(parallel:spec|spec(:|$))/).any? + Rails.env = ENV["RAILS_ENV"] ||= "test" + end end Dotenv.instrumenter = ActiveSupport::Notifications