jnicklas/capybara — pull request #641 by robinroestenburg (2012-02-16 23:16:56+00:00)
Title: Fixed failure messages when using :count on have_selector

## Problem
The `have_selector` method generates the following error when it cannot find a matching element for a given (in this case css) selector:

``` text
expected css ".foo" to return something
```

When using a `:count` option to the `have_selector` call (using a selector that matches elements) it generates the same error when the given count is bigger than number of found elements.

## Cause
The `error`-method on the `Query` class does not check for the presence of the `@options[:count]` (e.g. as the `HaveMatcher` class' failure message method does).

## Solution
I've added the condition to the `error`-method and I've added some tests for it (also made some changed some descriptions of specs that were not correct - couldn't help it ;)).

FYI: I'm working on a refactoring to remove the duplication in the failure message generation - hope to be able to squeeze in some hours this weekend.