aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/tasks/testing.rake
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 04:38:39 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 04:38:39 +0000
commit985cb441103c79651f12a013326aa15f54fa8182 (patch)
tree4aa28f1488ba5cdf66e58ed6df0aa448dfdbba0b /railties/lib/tasks/testing.rake
parent1a06d324df43bfb3287293934f0ef34a7c790a34 (diff)
downloadrails-985cb441103c79651f12a013326aa15f54fa8182.tar.gz
rails-985cb441103c79651f12a013326aa15f54fa8182.tar.bz2
rails-985cb441103c79651f12a013326aa15f54fa8182.zip
Added namespaces to all tasks, so for example load_fixtures is now db:fixtures:load. All the old task names are still valid, they just point to the new namespaced names. "rake -T" will only show the namespaced ones, though [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3680 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/tasks/testing.rake')
-rw-r--r--railties/lib/tasks/testing.rake74
1 files changed, 42 insertions, 32 deletions
diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake
index 5792f063ac..b4d318da57 100644
--- a/railties/lib/tasks/testing.rake
+++ b/railties/lib/tasks/testing.rake
@@ -10,41 +10,51 @@ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
end.compact
end
-desc 'Test recent changes'
-Rake::TestTask.new(:recent => [ :prepare_test_database ]) do |t|
- since = TEST_CHANGES_SINCE
- touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
- recent_tests('app/models/*.rb', 'test/unit', since) +
- recent_tests('app/controllers/*.rb', 'test/functional', since)
-
- t.libs << 'test'
- t.verbose = true
- t.test_files = touched.uniq
-end
-desc "Run the unit tests in test/unit"
-Rake::TestTask.new(:test_units => [ :prepare_test_database ]) do |t|
- t.libs << "test"
- t.pattern = 'test/unit/**/*_test.rb'
- t.verbose = true
+desc 'Test all units and functionals'
+task :test do
+ Rake::Task["test:units"].invoke rescue got_error = true
+ Rake::Task["test:functional"].invoke rescue got_error = true
+ raise "Test failures" if got_error
end
-desc "Run the functional tests in test/functional"
-Rake::TestTask.new(:test_functional => [ :prepare_test_database ]) do |t|
- t.libs << "test"
- t.pattern = 'test/functional/**/*_test.rb'
- t.verbose = true
-end
+namespace :test do
+ desc 'Test recent changes'
+ Rake::TestTask.new(:recent => "db:test:prepare") do |t|
+ since = TEST_CHANGES_SINCE
+ touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
+ recent_tests('app/models/*.rb', 'test/unit', since) +
+ recent_tests('app/controllers/*.rb', 'test/functional', since)
-desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
-Rake::TestTask.new(:test_plugins => :environment) do |t|
- t.libs << "test"
-
- if ENV['PLUGIN']
- t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb"
- else
- t.pattern = 'vendor/plugins/**/test/**/*_test.rb'
+ t.libs << 'test'
+ t.verbose = true
+ t.test_files = touched.uniq
end
- t.verbose = true
-end
+ desc "Run the unit tests in test/unit"
+ Rake::TestTask.new(:units => "db:test:prepare") do |t|
+ t.libs << "test"
+ t.pattern = 'test/unit/**/*_test.rb'
+ t.verbose = true
+ end
+
+ desc "Run the functional tests in test/functional"
+ Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
+ t.libs << "test"
+ t.pattern = 'test/functional/**/*_test.rb'
+ t.verbose = true
+ end
+
+ desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
+ Rake::TestTask.new(:plugins => :environment) do |t|
+ t.libs << "test"
+
+ if ENV['PLUGIN']
+ t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb"
+ else
+ t.pattern = 'vendor/plugins/**/test/**/*_test.rb'
+ end
+
+ t.verbose = true
+ end
+end \ No newline at end of file