Debugger breakpoint ignored in Rails 3 test

For some reason my debugger breakpoint is ignored when I run a single
test, but the debugger works in the development environment.

Is there anything that I may have missed transitioning from 2.x to 3.x
to make the debugger work during tests?

On 13 April 2011 13:53, Fernando P. [email protected] wrote:

For some reason my debugger breakpoint is ignored when I run a single
test, but the debugger works in the development environment.

Is there anything that I may have missed transitioning from 2.x to 3.x
to make the debugger work during tests?

Are you using a ruby command to run the test, ie ruby
some_file.rb? If so then use rdebug rather than ruby.

Colin

Are you using a ruby command to run the test, ie ruby
some_file.rb? If so then use rdebug rather than ruby.

Indeed Colin, I just tried with rdebug and now the breakpoints are
honored. But it’s a bit painful to use on a single test as the debugger
stops once when it hits the require ‘test_helper’ line and another time
when it starts loading the class of the test file.

Can’t I just use ruby like before?

$ ruby -I test test/functional/pages_controller_test.rb -n some_test ?

On 14 April 2011 10:37, Fernando P. [email protected] wrote:

Are you using a ruby command to run the test, ie ruby
some_file.rb? If so then use rdebug rather than ruby.

Indeed Colin, I just tried with rdebug and now the breakpoints are
honored. But it’s a bit painful to use on a single test as the debugger
stops once when it hits the require ‘test_helper’ line and another time
when it starts loading the class of the test file.

Can’t I just use ruby like before?

Typing rdebug with no params shows the command line options. It looks
like --no-stop prevents the initial break on startup.

Colin

Is there anything that I may have missed transitioning from 2.x to 3.x

Do you have

group :development, :test do
gem ‘ruby-debug’
end

in your Gemfile?

On Wed, Apr 13, 2011 at 4:53 PM, Fernando P. [email protected]
wrote:

For some reason my debugger breakpoint is ignored when I run a single
test, but the debugger works in the development environment.

Do you have

group :development, :test do
gem ‘ruby-debug’
end

in your Gemfile?

Sorta’

I actually have:

group :development, :test do
gem ‘ruby-debug19’
end

I often find that the ‘debugger’ statement is skipped when a test dies
before I anticipated, well before the statement itself.

If you are running rspec, add --debug to the command to honor the
breakpoints.

Running rake also honors the breakpoints.