在 Rails 4 功能规范中,使用 RSpec 3 和 Capybara,我如何断言页面中是否存在一定数量的特定标签?
我试过了:
expect(find('section.documents .document').count).to eq(2)
但它不起作用,说:
Ambiguous match, found 2 elements matching css "section.documents .document"
此外,在功能规范中测试视图中使用的标签和类的种类是一个好主意/坏做法吗?