Rake tasks to invoke single tests/specs with rakish syntax
Latest commit 6b5a2f6 Nov 15, 2013 @grosser Merge pull request #13 from Florent2/patch-1
Fix typo
Failed to load latest commit information.
lib v0.6.0 Aug 17, 2013
spec modernize Aug 17, 2013
.travis.yml modernize Aug 17, 2013
Gemfile modernize Aug 17, 2013
Gemfile.lock v0.6.0 Aug 17, 2013
MIT-LICENSE license Aug 26, 2013
Rakefile modernize Aug 17, 2013
Readme.md Fix typo Nov 14, 2013
gem-public_cert.pem modernize Aug 17, 2013
single_test.gemspec modernize Aug 17, 2013


Runs a single test/spec via rake.


sudo gem install single_test

Include in your Rakefile:

require 'single_test/tasks'


Single test/spec

Searches for test-files matching the given name.

rake spec:user          #run spec/model/user_spec.rb
rake test:users_c       #run test/functional/users_controller_test.rb
rake spec:admin/users_c #run spec/controllers/admin/users_controller_spec.rb
rake test:u*hel         #run test/helpers/user_helper_test.rb

Searches for test-files by class (Foo::Bar -> foo/bar)

rake spec:Foo::Bar #run spec/foo/bar_spec.rb

Single test-case/example

rake spec:user:token    #run the first spec in user_spec.rb that matches /token/
rake test:user:token    #run all tests in user_test.rb that match /token/


rake spec:user X=       #run test on spec_sever (if one is running...), very fast for quick failure pin-pointing

All one by one

rake spec:one_by_one    #run each spec/test one by one, to find tests that fail when ran
rake test:one_by_one    #on their own or produce strange output

For last modified file

rake test:last
rake spec:last


  • if script/spec is missing, it will use just spec for specs (which solves some issues)
  • run whole describe blocks: describe 'xxx' do describe 'yyy' --> rake spec:file:'xxx yyy'
  • run single examples or describe blocks via line-numbers rspec spec/foo_spec:123


  • make test:last more clever e.g. lib -> try spec + spec/lib



Michael Grosser
License: MIT Build Status