1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/tasks/list_tests.rake
tsaleh 4ae2cea036 small refactorings
git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@389 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
2008-03-17 14:03:11 +00:00

23 lines
654 B
Ruby

namespace :shoulda do
desc "List the names of the test methods in a specification like format"
task :list do
require 'test/unit'
require 'rubygems'
require 'active_support'
# bug in test unit. Set to true to stop from running.
Test::Unit.run = true
test_files = Dir.glob(File.join('test', '**', '*_test.rb'))
test_files.each do |file|
load file
klass = File.basename(file, '.rb').classify.constantize
puts klass.name.gsub('Test', '')
test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort
test_methods.each {|m| puts " " + m }
end
end
end