我有以下雷神命令:
require 'highline'
class Import < Thor
desc "files", "Import files into the database"
method_option "path", :required => true, :desc => "Path to folder containing new files", :aliases => "-p", :type => :string
def files
require './config/environment'
line = HighLine.new
line.say(line.color("Identified files as Version 15 (English)", :green))
if line.agree(line.color("Are you sure you want to import?", :yellow))
line.say(line.color("Finished. Imported 70,114 items", :green))
else
line.say(line.color("Aborting...", :red))
end
end
end
现在,显然,目前这只是在屏幕上输出一些语言。但是,我需要做的是为测试输出的命令编写一个测试,正如我所期望的那样,当我开始从事繁重的工作时,我可以将这些东西存根。
我看过Aruba,但出于某种原因,这似乎不喜欢交互性,目前尚不清楚原因。
因此,是否有人对如何测试(使用 RSpec)有任何想法?