jnicklas/capybara — pull request #602 by jdelStrother (2012-01-09 12:20:18+00:00)
Title: Raise ArgumentError when passing invalid keys to has_selector?

It's a relatively common misconception that you can use :content as a key - e.g.

has_selector?('h1', :content=>'wooo!')

which would silently pass, even when 'wooo!' is nowhere to be found. This change should make that error much more obvious.

Related issues : https://github.com/jnicklas/capybara/issues/525

It would be nice to raise an error on passing a block in - eg
```
@session.should have_selector("//p") do |p_tag|
p_tag.should have_selector("//a")
end
```
which seems to be a common error on people switching to capybara via webrat. However, that's a bit more tricky and would probably need fixing at the rspec-matcher level, since the block doesn't make it as far as has_selector? and gets silently discarded.