我正在尝试编写 Capybara 测试用例。HTML 看起来像这样,通过将“page.body”写入文件获得:
<div class="diet_form"><div class="wrapper_no_arrow">
<div class="header">
<form name="diet" id="new-diet">
<label for="name"> New Diet's Name</label>
<input type="text" value="" id="name" name="name" />
<a id="submit_button" class="button-green">Create Diet</a>
我正在尝试找出正确的水豚匹配:
fill_in "name", :with => "test diet"
page.should have_link("submit_button")
这两个语句找不到输入框和提交按钮。有人可以帮我为此编写正确的匹配器吗?
这是第二条语句的错误:
Failure/Error: page.should have_link("submit_button")
expected link "submit_button" to return something