我正在进行Rails集成测试,有人编写的测试在过去是通过的,但现在却出现了警告。
这是我正在处理的代码行:
assert_select "a[href=/monster_xml_users/#{user_xml.id}][data-method=delete]", I18n.t('revoke_access')
但现在它显示警告:
无效的CSS选择器,断言未运行。
但如果我这样写:
assert_select "a", I18n.t('revoke_access')
assert_select "a" do
assert_select "[href=?]","/monster_xml_users/#{user_xml.id}"
assert_select "[data-method=?]", "delete"
end
然后它没有发出警告,测试通过并且是正确的。 但是我无法弄清楚为什么之前的断言现在失败了? 在Rails 4.2中,assert_select语法是否已更改?