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 = {}