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:
parent
4bf42ca006
commit
e9e2bb0360
2 changed files with 14 additions and 14 deletions
|
@ -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)
|
||||||
|
|
|
@ -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 = {}
|
||||||
|
|
Loading…
Reference in a new issue