rails/commands — pull request #9 by qrush (2012-12-21 22:04:00+00:00)
Title: Bring in M to run tests! :metal:

Run the entire test suite:

`test`

Run a directory of tests:

`test "unit"`

Run an entire test:

`test "unit/upload"`

Run a specific test:

```
irb(main):002:0> test "unit/upload:123"
No tests found on line 123. Valid tests to run:
test_create: m test/unit/upload_test.rb:4
...
=> true
```

Some problems with this:

* You need to have the rails console in test environment to use this.
* I killed the `print_test_usage` help for now.
* This only works with 1.9+, MiniTest, or Test/Unit right now.
* Forking to run tests and canceling them causes MySQL to barf: `ActiveRecord::StatementInvalid: Mysql2::Error: MySQL server has gone away mysql_errno=2006 sqlstate=HY000: SELECT @@FOREIGN_KEY_CHECKS`
* MiniTest spits this out for me on killing the console, not sure why yet or if this is normal:

```
/Users/qrush/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/test/unit.rb:49:in `process_args': invalid option: --readline (OptionParser::InvalidOption)
from /Users/qrush/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/minitest-2.12.1/lib/minitest/unit.rb:956:in `_run'
```