这两个示例都将转到 STDOUT,但 cucumber 只看到第一个。第二种情况失败:
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