thoughtbot/capybara-webkit — pull request #502 by jivagoalves (2013-03-29 16:59:49+00:00)
Title: Ignore messages that matches a given pattern

cc @jferris

This PR adds a new feature so that the user will be able to ignore messages from output by using a pattern. This is useful to get rid of annoying messages.

For example, after running the following code:

```ruby
# ignore_pattern.rb

$LOAD_PATH.unshift "/vagrant/lib"
require "capybara"
require "capybara-webkit"

html = %(

Hello World

)
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }

sess = Capybara::Session.new(:webkit, app)
sess.visit("/")
```
You should see a warning `"QFont::setPixelSize: Pixel size <= 0"`:
```bash
vagrant@precise32:/vagrant$ ruby ignore_pattern.rb
QFont::setPixelSize: Pixel size <= 0 (0)
vagrant@precise32:/vagrant$
```
If you ask the driver to ignore it:
```ruby
# ignore_pattern.rb

$LOAD_PATH.unshift "/vagrant/lib"
require "capybara"
require "capybara-webkit"

html = %(

Hello World

)
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }

sess = Capybara::Session.new(:webkit, app)
sess.driver.ignore("QFont::setPixelSize: Pixel size <= 0")
sess.visit("/")
```
Then you shouldn't see any `QFont::setPixelSize: Pixel size <= 0` from the output:
```bash
vagrant@precise32:/vagrant$ ruby ignore_pattern.rb
vagrant@precise32:/vagrant$
```