mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Remove needless old_editor restoration
Unfortunately nested assignments to @old_editor meant that the original @old_editor was permanently lost. This caused sporadic failures of spec/editor_spec.rb which was relying on Pry.config.editor containing a string.
This commit is contained in:
parent
15caf5fb87
commit
4044682704
1 changed files with 0 additions and 21 deletions
|
@ -381,16 +381,12 @@ describe "edit" do
|
|||
|
||||
describe 'without -p' do
|
||||
before do
|
||||
@old_editor = Pry.config.editor
|
||||
@file = @line = @contents = nil
|
||||
Pry.config.editor = lambda do |file, line|
|
||||
@file = file; @line = line
|
||||
nil
|
||||
end
|
||||
end
|
||||
after do
|
||||
Pry.config.editor = @old_editor
|
||||
end
|
||||
|
||||
it "should correctly find a class method" do
|
||||
pry_eval 'edit X.x'
|
||||
|
@ -427,7 +423,6 @@ describe "edit" do
|
|||
|
||||
describe 'with -p' do
|
||||
before do
|
||||
@old_editor = Pry.config.editor
|
||||
Pry.config.editor = lambda do |file, line|
|
||||
lines = File.read(file).lines.to_a
|
||||
lines[1] = ":maybe\n"
|
||||
|
@ -439,10 +434,6 @@ describe "edit" do
|
|||
end
|
||||
end
|
||||
|
||||
after do
|
||||
Pry.config.editor = @old_editor
|
||||
end
|
||||
|
||||
it "should successfully replace a class method" do
|
||||
pry_eval 'edit -p X.x'
|
||||
|
||||
|
@ -579,7 +570,6 @@ describe "edit" do
|
|||
|
||||
describe 'on an aliased method' do
|
||||
before do
|
||||
@old_editor = Pry.config.editor
|
||||
Pry.config.editor = lambda do |file, line|
|
||||
lines = File.read(file).lines.to_a
|
||||
lines[1] = '"#{super}aa".to_sym' + "\n"
|
||||
|
@ -589,9 +579,6 @@ describe "edit" do
|
|||
nil
|
||||
end
|
||||
end
|
||||
after do
|
||||
Pry.config.editor = @old_editor
|
||||
end
|
||||
|
||||
it "should change the alias, but not the original, without breaking super" do
|
||||
|
||||
|
@ -609,16 +596,12 @@ describe "edit" do
|
|||
|
||||
describe 'with three-arg editor' do
|
||||
before do
|
||||
@old_editor = Pry.config.editor
|
||||
@file = @line = @reloading = nil
|
||||
Pry.config.editor = lambda do |file, line, reloading|
|
||||
@file = file; @line = line; @reloading = reloading
|
||||
nil
|
||||
end
|
||||
end
|
||||
after do
|
||||
Pry.config.editor = @old_editor
|
||||
end
|
||||
|
||||
it "should pass the editor a reloading arg" do
|
||||
pry_eval 'edit X.x'
|
||||
|
@ -652,7 +635,6 @@ describe "edit" do
|
|||
end
|
||||
|
||||
it 'should edit method context' do
|
||||
old_editor = Pry.editor
|
||||
Pry.editor = lambda do |file, line|
|
||||
[file, line].should == BinkyWink.instance_method(:tots_macgee).source_location
|
||||
nil
|
||||
|
@ -660,11 +642,9 @@ describe "edit" do
|
|||
|
||||
t = pry_tester(BinkyWink.new.tots_macgee)
|
||||
t.process_command "edit -m -n"
|
||||
Pry.editor = old_editor
|
||||
end
|
||||
|
||||
it 'errors when cannot find method context' do
|
||||
old_editor = Pry.editor
|
||||
Pry.editor = lambda do |file, line|
|
||||
[file, line].should == BinkyWink.instance_method(:tits_macgee).source_location
|
||||
nil
|
||||
|
@ -673,7 +653,6 @@ describe "edit" do
|
|||
t = pry_tester(BinkyWink.new.tits_macgee)
|
||||
lambda { t.process_command "edit -m -n" }.should.
|
||||
raise(Pry::CommandError).message.should.match(/Cannot find a file for/)
|
||||
Pry.editor = old_editor
|
||||
end
|
||||
|
||||
it 'errors when a filename arg is passed with --method' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue