mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Add mock_pry to tests.
This is the most common using for redirect_pry_io.
This commit is contained in:
parent
03a72882f2
commit
f8b7260872
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue