1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

move mock_pry to local spec/helper.rb

This commit is contained in:
John Mair 2012-12-09 00:05:39 +01:00
parent 4bf42ca006
commit e9e2bb0360
2 changed files with 14 additions and 14 deletions

View file

@ -67,20 +67,6 @@ module PryTestHelpers
Pry::Helpers::CommandHelpers.unindent(*args) Pry::Helpers::CommandHelpers.unindent(*args)
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
def mock_command(cmd, args=[], opts={}) def mock_command(cmd, args=[], opts={})
output = StringIO.new output = StringIO.new
ret = cmd.new(opts.merge(:output => output)).call_safely(*args) ret = cmd.new(opts.merge(:output => output)).call_safely(*args)

View file

@ -31,6 +31,20 @@ def redirect_pry_io(new_in, new_out = StringIO.new)
end end
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 Pad = OpenStruct.new
def Pad.clear def Pad.clear
@table = {} @table = {}