RSpec での assert_select

私的メモ。
Rails 1.2.x で導入された assert_select は response に含まれるエレメントを CSS 形式で指定できるというすぐれもの。
で、RSpec on Rails からもまだ API が不安定*1ながらも使えるんですが、その API がまた変わりました。(r1399:r1419 のどっか)

  response.should_have "div#element_id ul li", :count => 10
  response.should_have "input[name='post[contents]']"

現( svn trunk(r1419))

  response.should have_tag("div#element_id ul li", :count => 10)
  response.should have_tag("input[name='post[contents]']")

reponse.should_have_tag() ではなく response.should( have_tag() ) なところに注意。

*1:よく変わるので公式にはアナウンスされていない