G
Greg Hurrell
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/
the_file_spec.rb".
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:
/usr/local/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/
context_eval.rb:116: `undefined method `context_setup' for class
`Object'' (NameError)
Or this:
`can't clone NilClass' (TypeError)
Or this:
`can't clone Fixnum' (TypeError)
Or this:
`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,
Greg
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/
the_file_spec.rb".
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:
/usr/local/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/
context_eval.rb:116: `undefined method `context_setup' for class
`Object'' (NameError)
Or this:
`can't clone NilClass' (TypeError)
Or this:
`can't clone Fixnum' (TypeError)
Or this:
`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,
Greg