test/test_helper.rb in pry-byebug-1.3.3 vs test/test_helper.rb in pry-byebug-2.0.0
- old
+ new
@@ -1,34 +1,35 @@
require 'pry/test/helper'
require 'minitest/autorun'
require 'pry-byebug'
require 'mocha/setup'
+#
# Set I/O streams. Out defaults to an anonymous StringIO.
+#
def redirect_pry_io(new_in, new_out = StringIO.new)
- old_in = Pry.input
- old_out = Pry.output
-
- Pry.input = new_in
- Pry.output = new_out
+ old_in, old_out = Pry.input, Pry.output
+ Pry.input, Pry.output = new_in, new_out
begin
yield
ensure
- Pry.input = old_in
- Pry.output = old_out
+ Pry.input, Pry.output = old_in, old_out
end
end
+def test_file(name)
+ (Pathname.new(__FILE__) + "../examples/#{name}.rb").cleanpath.to_s
+end
+
+#
+# Simulate pry-byebug's input for testing
+#
class InputTester
def initialize(*actions)
@orig_actions = actions.dup
@actions = actions
end
def readline(*)
@actions.shift
- end
-
- def rewind
- @actions = @orig_actions.dup
end
end