title: How do I invoke the debugger in a Rails functional test?
body: <p>With Rails 3, Ruby 1.9, and Test::Unit, what's the right way to invoke the debugger on a functional test? I've tried adding "debugger" and then running rake:test:functionals:</p>
  
  <pre><code>class AdminControllerTest &lt; ActionController::TestCase
      test "should get index" do
          debugger
          get :index
          assert_redirected_to welcome_url
      end
  end
  </code></pre>
  
  <p>but Ruby seems to ignore the call to debugger (the test goes ahead and runs normally). If I try running the test directly:</p>
  
  <pre><code>ruby -r debug test/functional/admin_controller_test.rb
  </code></pre>
  
  <p>then Ruby can't find test_helper.rb.  If, following the answer below, I run:</p>
  
  <pre><code>ruby -I "lib:test" test/functional/admin_controller_test.rb
  </code></pre>
  
  <p>then it finds test_helper but again runs the test to completion without invoking the debugger. My Gemfile does have:</p>
  
  <pre><code>gem 'ruby-debug19', :require =&gt; 'ruby-debug', :group =&gt; :development
  </code></pre>