#!/usr/bin/env ruby require "expect" require "pty" config_path = "/tmp/test-trollolorc-#{rand(100000)}" bin_path = File.expand_path('../../../../bin/trollolo',__FILE__) ENV["TROLLOLO_CONFIG_PATH"] = config_path PTY.spawn("#{bin_path} #{ARGV.join(" ")}") do |trollolo_out,trollolo_in,pid| if !trollolo_out.expect("key:",2) exit 1 end trollolo_in.puts("xxx") if !trollolo_out.expect("token:",2) exit 1 end end