Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 157e64b

Browse files
committed
Merge pull request #980 from rspec/remove_debugger
Remove debugger support.
2 parents 41bc11a + e6d9b7a commit 157e64b

File tree

9 files changed

+6
-143
lines changed

9 files changed

+6
-143
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Breaking Changes for 3.0.0:
1616
* `Spec::Runner.configure` rather than `RSpec.configure`.
1717
* `Rake::SpecTask` rather than `RSpec::Core::RakeTask`.
1818
* Remove deprecated support for `share_as` (Myron Marston).
19+
* Remove `--debug` option (and corresponding option on
20+
`RSpec::Core::Configuration`). Instead, use `-r<debugger gem name>` to
21+
load whichever debugger gem you wish to use (e.g. `ruby-debug`,
22+
`debugger`, or `pry`) (Myron Marston).
1923

2024
Enhancements
2125

lib/rspec/core.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
require 'rbconfig'
1414
require_rspec['core/filter_manager']
1515
require_rspec['core/dsl']
16-
require_rspec['core/extensions/kernel']
1716
require_rspec['core/extensions/ordered']
1817
require_rspec['core/deprecation']
1918
require_rspec['core/reporter']

lib/rspec/core/configuration.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -492,31 +492,6 @@ def requires=(paths)
492492
@requires += paths
493493
end
494494

495-
def debug=(bool)
496-
return unless bool
497-
begin
498-
require 'ruby-debug'
499-
Debugger.start
500-
rescue LoadError => e
501-
raise <<-EOM
502-
503-
#{'*'*50}
504-
#{e.message}
505-
506-
If you have it installed as a ruby gem, then you need to either require
507-
'rubygems' or configure the RUBYOPT environment variable with the value
508-
'rubygems'.
509-
510-
#{e.backtrace.join("\n")}
511-
#{'*'*50}
512-
EOM
513-
end
514-
end
515-
516-
def debug?
517-
!!defined?(Debugger)
518-
end
519-
520495
# Run examples defined on `line_numbers` in all files to run.
521496
def line_numbers=(line_numbers)
522497
filter_run :line_numbers => line_numbers.map{|l| l.to_i}

lib/rspec/core/configuration_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def filter_manager
4646
private
4747

4848
NON_FORCED_OPTIONS = [
49-
:debug, :requires, :libs, :profile, :drb, :files_or_directories_to_run,
49+
:requires, :libs, :profile, :drb, :files_or_directories_to_run,
5050
:line_numbers, :full_description, :full_backtrace, :tty
5151
].to_set
5252

lib/rspec/core/extensions/kernel.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/rspec/core/option_parser.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ def parser(options)
7575
options[:order] = "rand:#{seed}"
7676
end
7777

78-
parser.on('-d', '--debugger', 'Enable debugging.') do |o|
79-
options[:debug] = true
80-
end
81-
8278
parser.on('--fail-fast', 'Abort the run on first failure.') do |o|
8379
options[:fail_fast] = true
8480
end

spec/rspec/core/configuration_options_spec.rb

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,6 @@
9494
end
9595
end
9696

97-
it "sets debug directly" do
98-
opts = config_options_object("--debug")
99-
config = RSpec::Core::Configuration.new
100-
config.should_receive(:debug=).with(true)
101-
opts.configure(config)
102-
end
103-
10497
it "merges --require specified by multiple configuration sources" do
10598
with_env_vars 'SPEC_OPTS' => "--require file_from_env" do
10699
opts = config_options_object(*%w[--require file_from_opts])
@@ -214,13 +207,6 @@
214207
end
215208
end
216209

217-
describe "--debug, -d" do
218-
it "sets :debug => true" do
219-
expect(parse_options("--debug")).to include(:debug => true)
220-
expect(parse_options("-d")).to include(:debug => true)
221-
end
222-
end
223-
224210
describe "--fail-fast" do
225211
it "defaults to false" do
226212
expect(parse_options[:fail_fast]).to be_false
@@ -251,38 +237,9 @@
251237
end
252238

253239
describe "--drb, -X" do
254-
context "combined with --debug" do
255-
it "turns off the debugger if --drb is specified first" do
256-
expect(config_options_object("--drb", "--debug").drb_argv).not_to include("--debug")
257-
expect(config_options_object("--drb", "-d" ).drb_argv).not_to include("--debug")
258-
expect(config_options_object("-X", "--debug").drb_argv).not_to include("--debug")
259-
expect(config_options_object("-X", "-d" ).drb_argv).not_to include("--debug")
260-
end
261-
262-
it "turns off the debugger option if --drb is specified later" do
263-
expect(config_options_object("--debug", "--drb").drb_argv).not_to include("--debug")
264-
expect(config_options_object("-d", "--drb").drb_argv).not_to include("--debug")
265-
expect(config_options_object("--debug", "-X" ).drb_argv).not_to include("--debug")
266-
expect(config_options_object("-d", "-X" ).drb_argv).not_to include("--debug")
267-
end
268-
269-
it "turns off the debugger option if --drb is specified in the options file" do
270-
File.open("./.rspec", "w") {|f| f << "--drb"}
271-
expect(config_options_object("--debug").drb_argv).not_to include("--debug")
272-
expect(config_options_object("-d" ).drb_argv).not_to include("--debug")
273-
end
274-
275-
it "turns off the debugger option if --debug is specified in the options file" do
276-
File.open("./.rspec", "w") {|f| f << "--debug"}
277-
expect(config_options_object("--drb").drb_argv).not_to include("--debug")
278-
expect(config_options_object("-X" ).drb_argv).not_to include("--debug")
279-
end
280-
end
281-
282240
it "does not send --drb back to the parser after parsing options" do
283241
expect(config_options_object("--drb", "--color").drb_argv).not_to include("--drb")
284242
end
285-
286243
end
287244

288245
describe "--no-drb" do
@@ -344,11 +301,10 @@
344301
File.open("./.rspec", "w") {|f| f << "--line 37"}
345302
File.open("./.rspec-local", "w") {|f| f << "--format global"}
346303
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--color"}
347-
with_env_vars 'SPEC_OPTS' => "--debug --example 'foo bar'" do
304+
with_env_vars 'SPEC_OPTS' => "--example 'foo bar'" do
348305
options = parse_options("--drb")
349306
expect(options[:color]).to be_true
350307
expect(options[:line_numbers]).to eq(["37"])
351-
expect(options[:debug]).to be_true
352308
expect(options[:full_description]).to eq([/foo\ bar/])
353309
expect(options[:drb]).to be_true
354310
expect(options[:formatters]).to eq([['global']])

spec/rspec/core/configuration_spec.rb

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,55 +1070,6 @@ def metadata_hash(*args)
10701070
end
10711071
end
10721072

1073-
describe "#debug=true" do
1074-
before do
1075-
if defined?(Debugger)
1076-
@orig_debugger = Debugger
1077-
Object.send(:remove_const, :Debugger)
1078-
else
1079-
@orig_debugger = nil
1080-
end
1081-
config.stub(:require)
1082-
Object.const_set("Debugger", debugger)
1083-
end
1084-
1085-
after do
1086-
Object.send(:remove_const, :Debugger)
1087-
Object.const_set("Debugger", @orig_debugger) if @orig_debugger
1088-
end
1089-
1090-
let(:debugger) { double('Debugger').as_null_object }
1091-
1092-
it "requires 'ruby-debug'" do
1093-
config.should_receive(:require).with('ruby-debug')
1094-
config.debug = true
1095-
end
1096-
1097-
it "starts the debugger" do
1098-
debugger.should_receive(:start)
1099-
config.debug = true
1100-
end
1101-
end
1102-
1103-
describe "#debug=false" do
1104-
it "does not require 'ruby-debug'" do
1105-
config.should_not_receive(:require).with('ruby-debug')
1106-
config.debug = false
1107-
end
1108-
end
1109-
1110-
describe "#debug?" do
1111-
it 'returns true if the debugger has been loaded' do
1112-
stub_const("Debugger", Object.new)
1113-
expect(config.debug?).to be_true
1114-
end
1115-
1116-
it 'returns false if the debugger has not been loaded' do
1117-
hide_const("Debugger")
1118-
expect(config.debug?).to be_false
1119-
end
1120-
end
1121-
11221073
describe "#output=" do
11231074
it "sets the output" do
11241075
output = double("output")

spec/rspec/core/kernel_extensions_spec.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)