Skip to content

Instantly share code, notes, and snippets.

@dcorrigan
Last active November 16, 2017 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcorrigan/5112eaa649c77061a56a6541168dd453 to your computer and use it in GitHub Desktop.
Save dcorrigan/5112eaa649c77061a56a6541168dd453 to your computer and use it in GitHub Desktop.
run rails 2.3 tests in the console

fire up the console in the test env:

RAILS_ENV=test script/console

then require a Ruby test runner:

require 'test/unit/ui/console/testrunner'

(should be loaded but doesn't hurt)

then manually load your test file, like:

load 'tests/some_controller_test.rb

and run it by passing the test class to the test runner:

Test::Unit::UI::Console::TestRunner.run SomeControllerTest

nb: you have to reload the test file every time you make a change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment