2006 年 7 月 30 日,星期日

CSS 选择器测试

发布者 David

如果你对 assert_tag 及其选项感到迷惑,那么不妨尝试使用 CSS 选择器。目前有两种处理该问题的插件:assert_selecthpricot helper

hpricot 风格提供了类似于 assert element('title').should_contain('Funky Chicken Title') 的内容,而 assert_select 则提供了类似于 assert_select "title", "Welcome" 的内容。

从快速浏览来看,我更喜欢 assert_select 风格。但我还没有在实际场景中使用过任何一种风格。请就此发表评论。其中一种方法很可能成为核心。