Skip to content

A platform for community discussion. Free, open, simple.

DEV: Automatically set LOAD_PLUGINS for bin/rspec (#30437)

David Taylor1f46aed27eb0
diff --git a/bin/rspec b/bin/rspec
index c36691f7ddd..55b87de6fe6 100755
--- a/bin/rspec
+++ b/bin/rspec
@@ -15,4 +15,9 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
require 'rubygems'
require 'bundler/setup'
+if ENV["LOAD_PLUGINS"].nil? && ARGV.any? { |pattern| pattern.include?("plugins/") }
+ STDERR.puts "Detected plugin spec path, setting LOAD_PLUGINS to 1"
+ ENV["LOAD_PLUGINS"] = "1"
+end
+
load Gem.bin_path('rspec-core', 'rspec')