【发布时间】:2009-11-10 15:09:44
【问题描述】:
我正在尝试测试命令行工具的输出。如何使用 rspec 来“伪造”命令行调用?执行以下操作无效:
it "should call the command line and return 'text'" do
@p = Pig.new
@p.should_receive(:run).with('my_command_line_tool_call').and_return('result text')
end
如何创建存根?
【问题讨论】:
-
我们能看到
Pig类的相关部分吗? -
有this(没用过)
标签: ruby command-line rspec