Add rake task for running plugin tests.

This commit is contained in:
Vikhyat Korrapati 2014-02-02 01:52:53 +05:30
parent 5958e710c0
commit 102352e205
2 changed files with 13 additions and 1 deletions

View File

@ -157,7 +157,7 @@ module Discourse
config.active_record.whitelist_attributes = false unless rails4?
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
# So open id logs somewhere sane

View File

@ -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')
abort('Unable to pull latest version of plugin') unless update_status
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