diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-04 18:04:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-04 18:04:55 +0000 |
commit | bfaf71cbc2a17be7f2d3b6f2ee18b4e03135a320 (patch) | |
tree | 441fc7b98c215a1d764c599eeddead0c5439c8eb /railties/lib | |
parent | 3dcf7fe4e91f0d032915d5ab6c1e7dfcfc0ab935 (diff) | |
download | rails-bfaf71cbc2a17be7f2d3b6f2ee18b4e03135a320.tar.gz rails-bfaf71cbc2a17be7f2d3b6f2ee18b4e03135a320.tar.bz2 rails-bfaf71cbc2a17be7f2d3b6f2ee18b4e03135a320.zip |
We need to silence_stderr on the call to svn in order not to get errors when svn is not available or the app is not checked in
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3759 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/tasks/testing.rake | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake index 293320b2df..5ccef4149b 100644 --- a/railties/lib/tasks/testing.rake +++ b/railties/lib/tasks/testing.rake @@ -11,6 +11,18 @@ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago) end +# Recreated here from ActiveSupport because :uncommitted needs it before Rails is available +module Kernel + def silence_stderr + old_stderr = STDERR.dup + STDERR.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null') + STDERR.sync = true + yield + ensure + STDERR.reopen(old_stderr) + end +end + desc 'Test all units and functionals' task :test do Rake::Task["test:units"].invoke rescue got_error = true @@ -38,8 +50,8 @@ namespace :test do desc 'Test changes since last checkin (only Subversion)' Rake::TestTask.new(:uncommitted => "db:test:prepare") do |t| - changed_since_checkin = `svn status`.map { |path| path.chomp[7 .. -1] } - models = changed_since_checkin.delete_if { |path| not path =~ /app\/models\/.*\.rb/ } + changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] } + models = changed_since_checkin.select { |path| path =~ /app\/models\/.*\.rb/ } tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" } t.libs << 'test' @@ -80,4 +92,4 @@ namespace :test do t.verbose = true end -end +end
\ No newline at end of file |