forked from rspec/rspec-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Make debugger statements _just work_"
- restore the --debugger/-d option - this created a situation in which debugger did not work at all with rails, so need to figure out a different solution This reverts commit 2466831.
- Loading branch information
1 parent
393626f
commit 2eb3c72
Showing
5 changed files
with
32 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,5 @@ | ||
module Kernel | ||
|
||
private | ||
|
||
alias_method :method_missing_without_debugger, :method_missing | ||
|
||
def method_missing(m, *a) | ||
if m.to_s == 'debugger' | ||
begin | ||
require 'ruby-debug' | ||
debugger | ||
rescue LoadError => e | ||
warn <<-EOM | ||
#{'*'*50} | ||
The debugger statement on the following line was ignored: | ||
#{caller(0).detect {|l| l !~ /method_missing/}} | ||
To use the debugger statement, you must install ruby-debug. | ||
#{'*'*50} | ||
EOM | ||
end | ||
else | ||
method_missing_without_debugger(m, *a) | ||
end | ||
end | ||
def debugger(*args) | ||
RSpec.configuration.error_stream.puts "debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}" | ||
end unless respond_to?(:debugger) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
require 'spec_helper' | ||
|
||
describe "extensions" do | ||
describe "#debugger" do | ||
it "warns if ruby-debug is not installed" do | ||
object = Object.new | ||
object.should_receive(:warn).with(/debugger .* ignored:\n.* ruby-debug/m) | ||
object.stub(:require) { raise LoadError } | ||
object.__send__ :method_missing, :debugger | ||
describe "debugger" do | ||
it "is defined on Kernel" do | ||
Kernel.should respond_to(:debugger) | ||
end | ||
end | ||
end |