When the text as invalid Regexp is given to `#have_text`, it raises the following error:
``` ruby
expect(page).to have_text('[]') #=> RegexpError: empty char-class: /[]/
```
We expect an error `Capybara::ExpectationNotMet`, not a `RegexpError`.
When testing a page with JS that hides and shows
certain elements, it's useful to know whether a
test failure means that an element has failed to
render, or has rendered but become invisible (or
failed to become visible).
For instance, some jQuery plugins will take
existing elements and hide them, adding some other
elements onto the page that use the originals as
storage. If your tests are written to use the
now-hidden elements they will mysteriously start
failing.
This commit only changes the behavior for failed
tests (rspec and assert) and only for text
queries. It might be nice to extend this to the
other finders.
* Add assert_text, assert_no_text, assert_title, assert_no_title
* Refactor query resolving
* Improve failure messages for have_text, have_title RSpec matchers (they will be the same as for added assert_* methods)
* Add Simple#inspect