2011-04-04 08:18:07 -04:00
|
|
|
# Ensure we do not execute any rc files
|
|
|
|
Pry::RC_FILES.clear
|
|
|
|
Pry.color = false
|
|
|
|
Pry.should_load_rc = false
|
|
|
|
|
2011-01-11 20:16:04 -05:00
|
|
|
class Module
|
|
|
|
public :remove_const
|
2010-12-21 09:03:52 -05:00
|
|
|
end
|
|
|
|
|
2011-03-05 09:17:54 -05:00
|
|
|
class << Pry
|
|
|
|
alias_method :orig_reset_defaults, :reset_defaults
|
|
|
|
def reset_defaults
|
|
|
|
orig_reset_defaults
|
|
|
|
Pry.color = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-12-21 09:03:52 -05:00
|
|
|
class InputTester
|
2010-12-24 03:30:51 -05:00
|
|
|
def initialize(*actions)
|
|
|
|
@orig_actions = actions.dup
|
|
|
|
@actions = actions
|
2010-12-21 09:03:52 -05:00
|
|
|
end
|
|
|
|
|
2011-01-09 06:51:45 -05:00
|
|
|
def readline(*)
|
2010-12-21 09:03:52 -05:00
|
|
|
@actions.shift
|
|
|
|
end
|
|
|
|
|
|
|
|
def rewind
|
2011-01-07 07:18:09 -05:00
|
|
|
@actions = @orig_actions.dup
|
2010-12-21 09:03:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-01-19 03:50:45 -05:00
|
|
|
class Pry
|
|
|
|
|
|
|
|
# null output class - doesn't write anywwhere.
|
|
|
|
class NullOutput
|
|
|
|
def self.puts(*) end
|
2011-04-07 21:06:39 -04:00
|
|
|
def self.string(*) end
|
2011-01-19 03:50:45 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2011-01-11 20:16:04 -05:00
|
|
|
class CommandTester < Pry::CommandBase
|
|
|
|
|
2011-01-17 09:38:09 -05:00
|
|
|
command "command1", "command 1 test" do
|
2011-01-21 04:17:12 -05:00
|
|
|
output.puts "command1"
|
2011-01-11 20:16:04 -05:00
|
|
|
end
|
|
|
|
|
2011-01-17 09:38:09 -05:00
|
|
|
command "command2", "command 2 test" do |arg|
|
2011-01-21 04:17:12 -05:00
|
|
|
output.puts arg
|
2010-12-21 09:03:52 -05:00
|
|
|
end
|
|
|
|
end
|