私はキュウリを学んでいますが、入力タグを一致させるためのステップを踏むことはできません。
私が見ているのは
<input type="submit" value="Press!" />
そしてキュウリで試したのは
Then the "input" field should contain "Press!"
Then the "type" field should contain "submit"
特定の値を持つ入力タグの存在を確認したいだけです。相互作用はありません。
私はキュウリを学んでいますが、入力タグを一致させるためのステップを踏むことはできません。
私が見ているのは
<input type="submit" value="Press!" />
そしてキュウリで試したのは
Then the "input" field should contain "Press!"
Then the "type" field should contain "submit"
特定の値を持つ入力タグの存在を確認したいだけです。相互作用はありません。
これを試して:
Then I should see "Press!" within "input[type=\"submit\"]"
また、webrat でも明示的にサポートされています。キュウリに組み込みのサポートが見つからない場合でも、いつでも独自のステップ定義にドロップできます。
ソース: http://cheat.errtheblog.com/s/webrat/
== Assertions
# check for text in the body of html tags
# can be a string or regexp
assert_contain("BURNINATOR")
assert_contain(/trogdor/i)
assert_not_contain("peasants")
# check for a css3 selector
assert_have_selector 'div.pagination'
assert_have_no_selector 'form input#name'
== Matchers
# check for text in the body of html tags
# can be a string or regexp
# Matchers are verbs used with auxillary verbs should, should_not, etc.
response.should contain("BURNINATOR")
response.should contain(/trogdor/i)
response.should_not contain("peasants")
# check for a css3 selector
response.should have_selector('div.pagination')
response.should_not have_selector('form input#name')
次のようなものを使用できます。
response.should have_xpath("//input[@value='Press!']")
また
response.should have_selector("input", :type => "submit", :value => "Press!")