【发布时间】:2018-07-30 15:46:32
【问题描述】:
我需要使用 rspec 脚本测试控制台应用程序并检查打印输出。示例:
RSpec.describe 'Test Suite', type: :aruba do
it "has aruba set up" do
command = run("echo 'hello world'")
stop_all_commands
expect(command.output).to eq("hello world\n")
end
它失败了:
Failure/Error: command = run("echo 'hello world'")
`run` is not available from within an example (e.g. an `it` block) or from constructs that run in the scope of an example (e.g. `before`, `let`, etc). It is only available on an example group (e.g. a `describe` or `context` block).
Aruba 版本 0.14.6,Rspec 3.7.0。将不胜感激任何帮助。谢谢。
【问题讨论】:
-
run方法定义在哪里?
-
根据文档 (rubydoc.info/github/cucumber/aruba/Aruba/Api/…),它应该是 run_command,但由于未知命令而失败。看起来
run是这个版本的 Aruba::Api 的正确选择。文档是 w....... -
"run 方法定义在哪里?" - 天知道.....在网上一无所获。 :(
标签: ruby rspec console-application aruba