0
目前我有下面的格式输出喜欢/不喜欢的表决功能:Webrat /黄瓜匹配器 - 测试内容匹配的链接
如果喜欢和不喜欢的是(#)表示的总计数的点击链接
我正在写黄瓜测试来检查喜欢/不喜欢的计数是否正确。我想检查
...
Then I should see "like (2) dislike (0)"
但是,我的黄瓜测试没有通过。有人有建议吗?该观点是如下:
<%= link_to "like", url_for(:action => 'like', :controller => 'comments', :id => c.id) %>
(<%= c.comment_votes.nil? ? 0 : c.comment_votes.count(:conditions => {:score => 1}) %>)
<%= link_to "dislike", url_for(:action => 'dislike', :controller => 'comments', :id => c.id) %>
(<%= c.comment_votes.nil? ? 0 : c.comment_votes.count(:conditions => {:score => -1}) %>)
如果删除链接,步骤是否会通过?您可能必须编写自定义匹配器才能匹配文本和链接。 – jspooner 2010-07-20 20:28:46