Is it possible to run RSpec specs from inside the Ruby debugger? I’ve
got a failing spec and I would like to single-step through the failing
code so as to figure out what’s going on. The alternative is not very
attractive: sprinkling my code with logging statements.
The specs run fine from the command line using “rake spec”; they also
run fine using the “spec” commandline tool; and the single file which
contains the failing spec also runs fun when executed using “ruby spec/
When I say “runs fine”, I mean the specs run, no extraneous error
messages are printed, and one of them fails.
But when I try to run the spec under the debugger using “ruby -r debug
spec/the_file_spec.rb” I get dozens of extraneous error messages which
make it totally impractical if not impossible to single-step. I set a
breakpoint on the line where I want to start inspecting things but I
never get there because I have to wade through hundreds or even
thousands of messages like this:
undefined methodcontext_setup’ for class
`can’t clone NilClass’ (TypeError)
`can’t clone Fixnum’ (TypeError)
`can’t modify literal regexp’ (SecurityError)
This only happens under the debugger. A Google search for “rspec
debugger” yields only one hit that doesn’t seem relevant. Has anyone
successfully run their RSpec specs under the debugger?
Thanks for any help you can give,