0
我想检查我的导航中包含的每个包含正则表达式的链接。在使用这样的代码之前,我已经检查了相同的导航链接:Rails:无法在assert_select块中使用正则表达式
assert_select "nav.active" do |nav|
assert_select nav, "a[href=?]", edit_post_path(post), count: 0
end
这很好。我无法使用正则表达式做类似的事情,如docs中所见。我一直在使用这些变化试过(两者在目的注释掉):
assert_select "nav.active" do |nav|
#assert_select "a[href=?]", /.+/
#assert_select nav, "a[href=?]", /foo/, count: 1
end
哪些失败并输出:
Minitest::Assertion: Expected exactly 1 element matching "a[href=/.+/]", found 0..
或
Minitest::Assertion: Expected exactly 1 element matching "a[href=/foo/]", found 0..
我在做什么错?