From f8b7260872c33acd22e47d4bcf1ec616faf0d7e9 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 24 Aug 2011 00:59:48 -0700 Subject: [PATCH] Add mock_pry to tests. This is the most common using for redirect_pry_io. --- test/helper.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/helper.rb b/test/helper.rb index 6b40ef97..9f00799a 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -46,6 +46,17 @@ def redirect_pry_io(new_in, new_out) end end +def mock_pry(*args) + input = InputTester.new(*args) + output = StringIO.new + + redirect_pry_io(input, output) do + Pry.start + end + + output.string +end + def redirect_global_pry_input(new_io) old_io = Pry.input Pry.input = new_io