Add rake task for running plugin tests.
This commit is contained in:
parent
5958e710c0
commit
102352e205
|
@ -157,7 +157,7 @@ module Discourse
|
||||||
config.active_record.whitelist_attributes = false unless rails4?
|
config.active_record.whitelist_attributes = false unless rails4?
|
||||||
|
|
||||||
require 'auth'
|
require 'auth'
|
||||||
Discourse.activate_plugins! unless Rails.env.test?
|
Discourse.activate_plugins! unless Rails.env.test? and ENV['LOAD_PLUGINS'] != "true"
|
||||||
|
|
||||||
config.after_initialize do
|
config.after_initialize do
|
||||||
# So open id logs somewhere sane
|
# So open id logs somewhere sane
|
||||||
|
|
|
@ -42,3 +42,15 @@ task 'plugin:update', :plugin do |t, args|
|
||||||
update_status = system('git --git-dir "' + plugin_path + '/.git" --work-tree "' + plugin_path + '" pull')
|
update_status = system('git --git-dir "' + plugin_path + '/.git" --work-tree "' + plugin_path + '" pull')
|
||||||
abort('Unable to pull latest version of plugin') unless update_status
|
abort('Unable to pull latest version of plugin') unless update_status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'run plugin specs'
|
||||||
|
task 'plugin:spec', :plugin do |t, args|
|
||||||
|
args.with_defaults(plugin: "**")
|
||||||
|
ruby = `which ruby`.strip
|
||||||
|
files = Dir.glob("./plugins/#{args[:plugin]}/spec/*.rb")
|
||||||
|
if files.length > 0
|
||||||
|
sh "LOAD_PLUGINS=true #{ruby} -S rspec #{files.join(' ')}"
|
||||||
|
else
|
||||||
|
abort "No specs found."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue