Skip to content

Commit

Permalink
move mock_pry to local spec/helper.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
banister committed Dec 8, 2012
1 parent 4bf42ca commit e9e2bb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 0 additions & 14 deletions lib/pry/test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,6 @@ def unindent(*args)
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)
Expand Down
14 changes: 14 additions & 0 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit e9e2bb0

Please sign in to comment.