aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Geukers <david.geukers@jadedpixel.com>2014-10-21 15:13:09 -0400
committerDavid Geukers <david.geukers@jadedpixel.com>2014-11-10 20:33:31 -0500
commit3b12abba3c4fa0dbd6e8c92bd68fa433847d142c (patch)
treeeffdf1947ddcca914a28c26b6900821c383ecf94 /railties
parent40e904df37253301c23f8abf87135d751bddfa9c (diff)
downloadrails-3b12abba3c4fa0dbd6e8c92bd68fa433847d142c.tar.gz
rails-3b12abba3c4fa0dbd6e8c92bd68fa433847d142c.tar.bz2
rails-3b12abba3c4fa0dbd6e8c92bd68fa433847d142c.zip
Simplify rake test vs rake test:all
Renames `rake test:all` to `rake test` by changing old `rake test:run` to previous version of `rake test:all`. Removes old definition of `rake test`. Also renames `rake test:all:db` to `rake test:db` and deprecates `rake test:all` & `rake test:all:db`
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md6
-rw-r--r--railties/lib/rails/test_unit/testing.rake23
2 files changed, 26 insertions, 3 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index e1a11482e6..201a73339a 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -181,4 +181,10 @@
*Yves Senn*, *Carlos Antonio da Silva*, *Robin Dupret*
+* Make `rake test` run all tests in test folder.
+
+ Deprecate `rake test:all` and replace `rake test:all:db` with `rake test:db`
+
+ *David Geukers*
+
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/railties/CHANGELOG.md) for previous changes.
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index 957deb8a60..0d0cfa3c6b 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -3,7 +3,7 @@ require 'rails/test_unit/sub_test_task'
task default: :test
-desc 'Runs test:units, test:functionals, test:generators, test:integration, test:jobs together'
+desc "Runs all tests in test folder"
task :test do
Rails::TestTask.test_creator(Rake.application.top_level_tasks).invoke_rake_task
end
@@ -13,17 +13,34 @@ namespace :test do
# Placeholder task for other Railtie and plugins to enhance. See Active Record for an example.
end
- task :run => ['test:units', 'test:functionals', 'test:generators', 'test:integration', 'test:jobs']
+ Rails::TestTask.new(:run) do |t|
+ t.pattern = "test/**/*_test.rb"
+ end
+
+ desc "Run tests quickly, but also reset db"
+ task :db => %w[db:test:prepare test]
- # Inspired by: http://ngauthier.com/2012/02/quick-tests-with-bash.html
desc "Run tests quickly by merging all types and not resetting db"
Rails::TestTask.new(:all) do |t|
t.pattern = "test/**/*_test.rb"
end
+ Rake::Task["test:all"].enhance do
+ Rake::Task["test:deprecate_all"].invoke
+ end
+
+ task :deprecate_all do
+ ActiveSupport::Deprecation.warn "rake test:all is deprecated and will be removed in Rails 5. " \
+ "Use rake test to run all tests in test directory."
+ end
+
namespace :all do
desc "Run tests quickly, but also reset db"
task :db => %w[db:test:prepare test:all]
+
+ Rake::Task["test:all:db"].enhance do
+ Rake::Task["test:deprecate_all"].invoke
+ end
end
Rails::TestTask.new(single: "test:prepare")