The following answer is based on: How to run single test from rails test suite? (stackoverflow)
But very briefly, here's the answer:
ruby -I test test/functional/whatevertest.rb
For a specific functional test, run:
ruby -I test test/functional/whatevertest.rb -n test_should_get_index
Just put underscores in places of spaces in test names (as above), or quote the title as follows:
ruby -I test test/functional/whatevertest.rb -n 'test should get index'
Note that for unit tests just replace functional with unit in the examples above. And if you're using bundler to manage your application's gem dependencies, you'll have to execute the tests with bundle exec as follows:
bundle exec ruby -I test test/unit/specific_model_test.rb
bundle exec ruby -I test test/unit/specific_model_test.rb -n test_divide_by_zero
bundle exec ruby -I test test/unit/specific_model_test.rb -n 'test divide by zero'
Most importantly, note that the argument to the -n switch is the name of the test, and the word "test" prepended to it, with spaces or underscores depending on whether you're quoting the name or not. The reason is that test is a convenience method. The following two methods are equivalent:
test "should get high" do
  assert true
end
def test_should_get_high
  assert true
end
...and can be executed as either of the following (they are equivalent):
bundle exec ruby -I test test/integration/misc_test.rb -n 'test should get high'
bundle exec ruby -I test test/integration/misc_test.rb -n test_should_get_high