From 8febaa8be75c6df759b6546e271a8262f582a486 Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Fri, 19 May 2017 12:38:36 +1000 Subject: [PATCH 1/2] FEATURE: Require spec helpers for plugins * Follows any symlinked plugins --- spec/rails_helper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 985bea4fb6e..9d88029d04d 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -29,6 +29,14 @@ Spork.prefork do Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} Dir[Rails.root.join("spec/fabricators/*.rb")].each {|f| require f} + # Require plugin helpers at plugin/[plugin]/spec/plugin_helper.rb (includes symlinked plugins). + if ENV['LOAD_PLUGINS'] == "1" + Dir[Rails.root.join("plugins/**")].each do |plugin| + helper = "#{plugin}/spec/plugin_helper.rb" + require helper if File.exists?(helper) + end + end + # let's not run seed_fu every test SeedFu.quiet = true if SeedFu.respond_to? :quiet From 2b5dfb6e8eb27f54c22e4c84ef4d288686d6bdae Mon Sep 17 00:00:00 2001 From: Rimian Perkins Date: Mon, 22 May 2017 14:50:53 +1000 Subject: [PATCH 2/2] avoid double lookup for plugin helpers --- spec/rails_helper.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 9d88029d04d..359727768d9 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -31,9 +31,8 @@ Spork.prefork do # Require plugin helpers at plugin/[plugin]/spec/plugin_helper.rb (includes symlinked plugins). if ENV['LOAD_PLUGINS'] == "1" - Dir[Rails.root.join("plugins/**")].each do |plugin| - helper = "#{plugin}/spec/plugin_helper.rb" - require helper if File.exists?(helper) + Dir[Rails.root.join("plugins/*/spec/plugin_helper.rb")].each do |f| + require f end end