From e9e2bb0360156acb163bb2d307f49e1573324deb Mon Sep 17 00:00:00 2001 From: John Mair Date: Sun, 9 Dec 2012 00:05:39 +0100 Subject: [PATCH] move mock_pry to local spec/helper.rb --- lib/pry/test/helper.rb | 14 -------------- spec/helper.rb | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/pry/test/helper.rb b/lib/pry/test/helper.rb index c9713edb..d702fce8 100644 --- a/lib/pry/test/helper.rb +++ b/lib/pry/test/helper.rb @@ -67,20 +67,6 @@ module PryTestHelpers Pry::Helpers::CommandHelpers.unindent(*args) end - def mock_pry(*args) - args.flatten! - binding = args.first.is_a?(Binding) ? args.shift : binding() - - input = InputTester.new(*args) - output = StringIO.new - - redirect_pry_io(input, output) do - binding.pry - end - - output.string - end - def mock_command(cmd, args=[], opts={}) output = StringIO.new ret = cmd.new(opts.merge(:output => output)).call_safely(*args) diff --git a/spec/helper.rb b/spec/helper.rb index a277c9e0..181e79be 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -31,6 +31,20 @@ def redirect_pry_io(new_in, new_out = StringIO.new) end end +def mock_pry(*args) + args.flatten! + binding = args.first.is_a?(Binding) ? args.shift : binding() + + input = InputTester.new(*args) + output = StringIO.new + + redirect_pry_io(input, output) do + binding.pry + end + + output.string +end + Pad = OpenStruct.new def Pad.clear @table = {}