I think you should be able to use `ReplTester` for that, which is an integration testing thing that actually runs the entire REPL. Check out `spec/pry_repl_spec.rb`.