Skip to content

Commit

Permalink
Split example from previous commit in two and reset Debugger
Browse files Browse the repository at this point in the history
- there are two separate requirements, so each one gets its own example
- need to able to use the debugger when running rspec on itself
  • Loading branch information
dchelimsky committed Dec 14, 2010
1 parent 5ef12e0 commit a9b0cfe
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions spec/rspec/core/configuration_spec.rb
Expand Up @@ -514,12 +514,32 @@ def that_thing
end

describe "#debug=true" do
before do
if defined?(Debugger)
@orig_debugger = Debugger
Object.send(:remove_const, :Debugger)
else
@orig_debugger = nil
end
Object.const_set("Debugger", debugger)
end

after do
Object.send(:remove_const, :Debugger)
Object.const_set("Debugger", @orig_debugger) if @orig_debugger
end

let(:debugger) { double('Debugger').as_null_object }

it "requires 'ruby-debug'" do
config.should_receive(:require).with('ruby-debug')
Object.const_set("Debugger", debugger = mock("Debugger"))
config.debug = true
end

it "starts the debugger" do
config.stub(:require)
debugger.should_receive(:start)
config.debug = true
Object.send(:remove_const, :Debugger)
end
end

Expand Down

0 comments on commit a9b0cfe

Please sign in to comment.