aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands.rb
diff options
context:
space:
mode:
authorPrem Sichanugrist and Chris Toomey <prem+chris@thoughtbot.com>2013-01-25 13:44:36 -0500
committerPrem Sichanugrist <s@sikac.hu>2013-03-09 16:03:54 -0500
commitb4df25366a3c8f133f8329bc35f1d53926704b5a (patch)
tree5a904251263f996bc8fd3eeed6fb9b4d3902692e /railties/lib/rails/commands.rb
parent15970efb2acc7767f2f20c5d649e53ace2e2ddb5 (diff)
downloadrails-b4df25366a3c8f133f8329bc35f1d53926704b5a.tar.gz
rails-b4df25366a3c8f133f8329bc35f1d53926704b5a.tar.bz2
rails-b4df25366a3c8f133f8329bc35f1d53926704b5a.zip
Add `rails test` command to run the test suite
To run the whole test suite: $ rails test To run the test file(s): $ rails test test/unit/foo_test.rb [test/unit/bar_test.rb ...] To run the test suite $ rails test [models,helpers,units,controllers,mailers,...] For more information, see `rails test --help`. This command will eventually replacing `rake test:*`, and `rake test` command will actually invoking `rails test` instead.
Diffstat (limited to 'railties/lib/rails/commands.rb')
-rw-r--r--railties/lib/rails/commands.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index aacde52cfc..c76af7d01f 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -5,6 +5,7 @@ aliases = {
"d" => "destroy",
"c" => "console",
"s" => "server",
+ "t" => "test",
"db" => "dbconsole",
"r" => "runner"
}
@@ -16,6 +17,7 @@ The most common rails commands are:
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
+ test Running the test file (short-cut alias: "t")
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
new Create a new Rails application. "rails new my_app" creates a
@@ -78,6 +80,19 @@ when 'server'
server.start
end
+when 'test'
+ $LOAD_PATH.unshift("./test")
+ require 'rails/commands/test_runner'
+ if ["-h", "--help"].include?(ARGV.first)
+ Rails::TestRunner.help_message
+ exit
+ else
+ require APP_PATH
+ Rails.application.require_environment!
+ Rails.application.load_tasks
+ Rails::TestRunner.start(ARGV)
+ end
+
when 'dbconsole'
require 'rails/commands/dbconsole'
Rails::DBConsole.start