【问题标题】:assert_select expectation contradicting itself (ruby)assert_select 期望自相矛盾(红宝石)
【发布时间】:2014-06-26 14:21:10
【问题描述】:

这是我测试中的代码:

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)

【问题讨论】:

    标签: ruby assert minitest assertions assertion


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 2019-05-16
      • 2021-04-13
      • 1970-01-01
      • 1970-01-01
      • 2019-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-23
      相关资源
      最近更新 更多