// stolen from here: http://nubyonrails.com/articles/2006/07/28/foscon-and-living-dangerously-with-rake
1
2
3
4
5
6
7
8
9
10
11 rule "" do |t|
12 if /(.*)_([^.]+)$/.match(t.name)
13 file_name = $1
14 test_name = $2
15 if File.exist?("test/unit/#{file_name}_test.rb")
16 file_name = "unit/#{file_name}_test.rb"
17 elsif File.exist?("test/functional/#{file_name}_controller_test.rb")
18 file_name = "functional/#{file_name}_controller_test.rb"
19 else
20 raise "No file found for #{file_name}"
21 end
22 sh "ruby -Ilib:test test/#{file_name} -n /^test_#{test_name}/"
23 end
24 end