1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Refactor test:uncommitted task.

Thanks to @sobrinho (Gabriel Sobrinho)
This commit is contained in:
Arun Agrawal 2011-11-09 09:46:06 +05:30
parent 6e87281b5f
commit 5f826ea26f

View file

@ -121,16 +121,9 @@ namespace :test do
models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb$/ }
controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb$/ }
unit_tests = models.map do |model|
file = "test/unit/#{File.basename(model, '.rb')}_test.rb"
file if File.exist?(file)
end
functional_tests = controllers.map do |controller|
file = "test/functional/#{File.basename(controller, '.rb')}_test.rb"
file if File.exist?(file)
end
(unit_tests.uniq + functional_tests.uniq).compact
unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" }
functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" }
(unit_tests + functional_tests).uniq.select { |file| File.exist?(file) }
end
t.libs << 'test'