Ruby on rails Cucumber table.diff表示表不相同-Rails
我对Rails和Cucumber非常陌生,所以这可能是一个快速解决方案,也可能不是Ruby on rails Cucumber table.diff表示表不相同-Rails,ruby-on-rails,ruby,testing,cucumber,Ruby On Rails,Ruby,Testing,Cucumber,我对Rails和Cucumber非常陌生,所以这可能是一个快速解决方案,也可能不是 我有一个cucumber场景,加载一组模型,然后检查它们是否都呈现到表中。Cucumber返回的结果是“表不相同”。我错过了什么?我尝试在第二步定义中添加标题,但这没有帮助。谢谢。 调试rails和rails测试的任何其他提示和技巧也会有所帮助。 这是我的设想 Scenario: View all the clients Given I am on the clients page And the followi
我有一个cucumber场景,加载一组模型,然后检查它们是否都呈现到表中。Cucumber返回的结果是“表不相同”。我错过了什么?我尝试在第二步定义中添加标题,但这没有帮助。谢谢。
调试rails和rails测试的任何其他提示和技巧也会有所帮助。
这是我的设想
Scenario: View all the clients
Given I am on the clients page
And the following clients exist:
|name|mobile|address|
|Bob|93838383|21 Test Street|
|Ian|87232878|1 Test Road|
|Matt|23762327367|55 Rails Drive|
Then I should see the following clients:
|Bob|93838383|21 Test Street|
|Ian|87232878|1 Test Road|
|Matt|23762327367|55 Rails Drive|
我的步骤定义
Given /^the following clients exist:$/ do |table|
table.hashes.each do |client|
Client.create!(client)
end
end
Then /^I should see the following clients:$/ do |table|
table.diff!(tableish('table tr', 'td'))
end
和我的视图文件
<h1>Clients</h1>
<table>
<% for client in @clients %>
<tr>
<td><%= client.name %></td>
<td><%= client.mobile %></td>
<td><%= client.address %></td>
</tr>
<% end %>
</table>
尝试将调试步骤添加到您的系统:
And show me the page
应该创建一个临时文件转储响应内容并在浏览器中打开它
编辑:我很确定这应该由webrat在features/steps/web_steps.rb中定义,谢谢。这有助于查明问题所在(我在加载记录之前浏览了网页)。。。
And show me the page