assert_select期望与自身矛盾(ruby)

时间:2014-06-26 14:21:11

标签: ruby assert minitest assertions assertion

这是我测试中的代码:

assert_select "a[href=?]", "/path/with?params", { :count => 1, :text => "" }

这是我得到的失败信息:

Expected exactly 1 element matching "a[href='/path/with?params']", found 0..
Expected: 0
Actual: 1

有什么线索在这里发生了什么?是期待0还是1,是否找到1或0?

更新:对于来到这里寻找如何做我想做的事的每个人,我最终都这样做了:

assert_match(/<a href="/path/with?params">/, response.body)

1 个答案:

答案 0 :(得分:1)