jonleighton/poltergeist — pull request #333 by alexspeller (2013-05-15 18:11:49+00:00)
Title: Fix bug with has_css

When using has_css with a count, I was finding that an error is
raise casued by trying to gsub on nil when the element is not.
present. This fix avoids that by casting to a string first,
ensuring the gsub method is available.

I think this was caused by this line mapping the result to text:

```
From: /Users/alex/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/capybara-2.1.0/lib/capybara/result.rb @ line 41 Capybara::Result#failure_message:

38: def failure_message
39: message = Capybara::Helpers.failure_message(@query.description, @query.options)
40: if count > 0
=> 41: message << ", found #{count} #{Capybara::Helpers.declension("match", "matches", count)}: " << @result.map(&:text).map(&:inspect).join(", ")
42: else
43: message << " but there were no matches"
44: end
45: unless @rest.empty?
46: elements = @rest.map(&:text).map(&:inspect).join(", ")
47: message << ". Also found " << elements << ", which matched the selector but not all filters."
48: end
49: message
50: end
```