drugpl/bbq — pull request #20 by jdudek (2011-12-11 22:17:31+00:00)
Title: Browser sessions pool

I wrote a (hopefully) better implementation of sessions pool (see #19).

The idea is that by default sessions are reused, using default pool `Bbq::Session.pool`. You can pass your own pool when creating `TestUser` (e.g. `TestUser.new(:pool => my_pool)`) or disable it by passing `:pool => false`. The pool is cleared in test teardown (or `after` in RSpec).

There's also a possibility to use your own `Capybara::Session` object, passed via `:session` option.

This does not solve #11, but we could add `Bbq::Session::Pool#kill` method that would close all sessions. Then, if you don't want to share sessions between test cases, you could call `Bbq::Session::pool.kill` in your teardown method.