This project is archived and is in readonly mode.
debugger statements not triggering the debugger in rails 3.0.4
Reported by Ross Heflin | February 12th, 2011 @ 01:41 AM
Summary:
Updated a rails app from 3.0.3 to 3.0.4 today
and discovered I could no longer hit breakpoints set within
tests.
Attached, you'll find a simple project which duplicates this
behavior.
I'm not sure if this is particularly a regression in rails,
but I don't see this behavior when using rails 3.0.3 with this
project
To Reproduce the Issue:
Blow out the attached tarball and cd into the foo directory, run the following commands:
rake db:reset
bundle install
rake test
Expected Behavior:
A debugger statement w/in the FooTest should be hit and opened in rdb with output like the following:
rheflin@elitethis:~/src/foo$ rake test
(in /home/rheflin/src/bs)
Loaded suite /home/rheflin/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
[2, 11] in test/unit/foo_test.rb
2
3 class FooTest < ActiveSupport::TestCase
4 # Replace this with your real tests.
5 test "the truth" do
6 debugger
=> 7 assert false
8 end
9 end
test/unit/foo_test.rb:7
assert false
(rdb:1)
Actual Behavior:
What actually happens is the breakpoint gets skipped and the test fails.
rheflin@elitethis:~/src/foo$ rake test
(in /home/rheflin/src/foo)
Loaded suite /home/rheflin/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
F
Finished in 0.265451 seconds.
1) Failure:
test_the_truth(FooTest) [test/unit/foo_test.rb:7]:
Failed assertion, no message given.
1 tests, 1 assertions, 1 failures, 0 errors, 0 skips
Test run options: --seed 36151
Errors running test:units!
rheflin@elitethis:~/src/foo$
Workaround
To get the breakpoint to trigger (as it did in 3.0.3) explicitly add require 'ruby-debug' to the test/test_helper.rb file so its contents match the following:
--- modified test/test_helper.rb
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'ruby-debug'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end
Then the breakpoint will be hit and you should drop into the debugger:
rheflin@elitethis:~/src/foo$ rake test
(in /home/rheflin/src/bs)
Loaded suite /home/rheflin/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
[2, 11] in test/unit/foo_test.rb
2
3 class FooTest < ActiveSupport::TestCase
4 # Replace this with your real tests.
5 test "the truth" do
6 debugger
=> 7 assert false
8 end
9 end
test/unit/foo_test.rb:7
assert false
(rdb:1)
My Environment details (in case they're needed):
OS: Ubuntu Linux 10.10 (maverick)
Arch: x86_64
Ruby: 1.9.2p136 (built by rvm 1.2.6)
I'll be happy to provide more information if needed, let me know.
Comments and changes to this ticket
-
Ross Heflin February 12th, 2011 @ 01:56 AM
- no changes were found...
-
Wojciech Wnętrzak February 12th, 2011 @ 11:55 AM
Try to change line in your Gemfile containing ruby-debug19:
gem "ruby-debug19", :require => "ruby-debug"
-
Wojciech Wnętrzak February 12th, 2011 @ 12:36 PM
I just checked, and on rails master, Gemfile is generated with this example, but without proper require.
I'm adding a patch with working example of ruby-debug19 gem. -
Repository February 13th, 2011 @ 12:41 AM
- State changed from new to committed
(from [22e14ea5739f552dfc663f563835fa27669d627d]) added proper require for ruby-debug19 gem to generated Gemfile
[#6419 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/22e14ea5739f552dfc663f563835f... -
Repository February 13th, 2011 @ 12:46 AM
(from [9c6f9c98b84827a55eba203c89611b7d9afd3cde]) added proper require for ruby-debug19 gem to generated Gemfile
[#6419 state:committed]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/9c6f9c98b84827a55eba203c89611...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 6419 debugger statements not triggering the debugger in rails 3.0.4 [#6419 state:committed]
- 6419 debugger statements not triggering the debugger in rails 3.0.4 [#6419 state:committed]