Skip to content

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

DEV: Allow to specify seed on rake task plugin:spec (#17770)

Sérgio Saquetimc99f658a9ed8
diff --git a/lib/tasks/plugin.rake b/lib/tasks/plugin.rake
index 451c7e23097..7b29c264e90 100644
--- a/lib/tasks/plugin.rake
+++ b/lib/tasks/plugin.rake
@@ -170,11 +170,15 @@ end
desc 'run plugin specs'
task 'plugin:spec', :plugin do |t, args|
args.with_defaults(plugin: "*")
- params = ENV['RSPEC_FAILFAST'] ? '--profile --fail-fast' : '--profile'
+
+ params = ['--profile']
+ params << '--fail-fast' if ENV['RSPEC_FAILFAST']
+ params << "--seed #{ENV['RSPEC_SEED']}" if Integer(ENV['RSPEC_SEED'], exception: false)
+
ruby = `which ruby`.strip
files = Dir.glob("./plugins/#{args[:plugin]}/spec/**/*_spec.rb").sort
if files.length > 0
- sh "LOAD_PLUGINS=1 #{ruby} -S rspec #{files.join(' ')} #{params}"
+ sh "LOAD_PLUGINS=1 #{ruby} -S rspec #{files.join(' ')} #{params.join(' ')}"
else
abort "No specs found."
end