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

Should be checking if file exists or not.

I found this bug when running rake test:uncommitted 
on a newly generated rails app which don't have
test file for application_controller.
Can see detail here #3461
This commit is contained in:
Arun Agrawal 2011-11-08 14:10:44 +05:30
parent 588faedaf4
commit fe67501e62

View file

@ -121,10 +121,16 @@ 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 { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" }
functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.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
(unit_tests.uniq + functional_tests.uniq).compact
end
t.libs << 'test'