#!/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| exit 1 unless trollolo_out.expect('key:', 2) trollolo_in.puts('xxx') exit 1 unless trollolo_out.expect('token:', 2) end