どちらの例もSTDOUTに送られますが、キュウリは最初の例しか見ません。2番目のシナリオは次の場合に失敗します。
Then the stdout should contain "test" # aruba-0.4.11/lib/aruba/cucumber.rb:82
expected "" to include "test" (RSpec::Expectations::ExpectationNotMetError)
features/test.feature:13:in `Then the output should contain "test"'
機能:
Scenario: echo test
Given a blank slate
When I run `echo "test"`
The stdout should contain "test"
Scenario: puts test
Given a blank slate
When I start the program
The stdout should contain "test"
ステップの定義:
When /^I start the program$/ do
TestModule::Main.new.start
end
コード:
module TestModule
class Main
def initialize
end
def start
$stdout.puts "test"
end
end
end