diff options
author | Arun Agrawal <arunagw@gmail.com> | 2011-11-08 14:10:44 +0530 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2011-11-08 15:51:47 +0530 |
commit | fe67501e62429a8d9c666837740cf9c1de1d4f87 (patch) | |
tree | 6166de1e85948624598165d27b2d06d32abb0854 /railties/lib | |
parent | 588faedaf405a20d6aab96f3b780d987263216dc (diff) | |
download | rails-fe67501e62429a8d9c666837740cf9c1de1d4f87.tar.gz rails-fe67501e62429a8d9c666837740cf9c1de1d4f87.tar.bz2 rails-fe67501e62429a8d9c666837740cf9c1de1d4f87.zip |
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
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 3d87529ad4..8bcceb9b2c 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -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' |