BDDにキュウリを使用しているときに、「表示する必要がある」メソッド(デフォルトの実装は失敗)という非常に奇妙なシナリオを見つけました。
これが私のシナリオ定義です:
When I go to signup page
And I fill in "Username" with "ben@test.com"
And I press "Sign up"
Then I should see "Anything that i type here. ABC XYZ"
明らかに、「ここに入力するものは何でも。ABCXYZ」というテキストはページにありませんが、キュウリはシナリオに失敗しません。これが「見るべき」の定義です
Then /^(?:|I )should see "([^"]*)"$/ do |text|
if page.respond_to? :should
page.should have_content(text)
else
assert page.has_content?(text)
end
end