From d29f6b5c04a685e9769cee46a6582a2088a40f71 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Sun, 13 Jan 2013 14:24:58 -0800 Subject: [PATCH] Fix indentation (HARDER) --- lib/pry/editor.rb | 8 +++--- spec/editor_spec.rb | 66 ++++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/pry/editor.rb b/lib/pry/editor.rb index 12c34164..8363071e 100644 --- a/lib/pry/editor.rb +++ b/lib/pry/editor.rb @@ -39,10 +39,10 @@ class Pry Pry.config.editor.call(*args) else sanitized_file = if windows? - file.gsub(/\//, '\\') - else - Shellwords.escape(file) - end + file.gsub(/\//, '\\') + else + Shellwords.escape(file) + end "#{Pry.config.editor} #{blocking_flag_for_editor(blocking)} #{start_line_syntax_for_editor(sanitized_file, line)}" end diff --git a/spec/editor_spec.rb b/spec/editor_spec.rb index d1a782df..4d8baa89 100644 --- a/spec/editor_spec.rb +++ b/spec/editor_spec.rb @@ -1,55 +1,55 @@ require 'helper' describe Pry::Editor do describe "build_editor_invocation_string" do - before do - class << Pry::Editor - public :build_editor_invocation_string - end + before do + class << Pry::Editor + public :build_editor_invocation_string end + end - it 'should shell-escape files' do - Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(/tmp/hello\\ world.rb) - end + it 'should shell-escape files' do + Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(/tmp/hello\\ world.rb) + end end describe "build_editor_invocation_string on windows" do - before do - class << Pry::Editor - def windows?; true; end - end + before do + class << Pry::Editor + def windows?; true; end end + end - after do - class << Pry::Editor - undef windows? - end + after do + class << Pry::Editor + undef windows? end + end - it "should replace / by \\" do - Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(\\tmp\\) - end + it "should replace / by \\" do + Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(\\tmp\\) + end - it "should not shell-escape files" do - Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(hello world.rb) - end + it "should not shell-escape files" do + Pry::Editor.build_editor_invocation_string("/tmp/hello world.rb", 5, true).should =~ %r(hello world.rb) + end end describe 'invoke_editor with a proc' do - before do - @old_editor = Pry.config.editor + before do + @old_editor = Pry.config.editor Pry.config.editor = proc{ |file, line, blocking| - @file = file - nil + @file = file + nil } - end + end - after do - Pry.config.editor = @old_editor - end + after do + Pry.config.editor = @old_editor + end - it 'should not shell-escape files' do - Pry::Editor.invoke_editor('/tmp/hello world.rb', 10, true) - @file.should == "/tmp/hello world.rb" - end + it 'should not shell-escape files' do + Pry::Editor.invoke_editor('/tmp/hello world.rb', 10, true) + @file.should == "/tmp/hello world.rb" + end end end