我需要使用 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。将不胜感激任何帮助。谢谢。