[rspec-users] Is it possible to access Example scope from Formatter?

Jarmo Pertman jarmo.p at gmail.com
Sun Oct 18 14:36:12 EDT 2009


I'm using Watir to perform some user interface tests. I've made my own
custom html formatter to make a screenshot and capture html of the
page, on which some spec fails.

Now, the problem is simple - I have to access the browser object from
my formatter to get window handle (for screenshot) and to get html of
the page. I thought that maybe it's possible to access the Example
object directly so I could get access to Example object instance
variables and helper methods, but it seems that only Proxies are in
use everywhere and they seem to be pretty limited.

Currently I'm just using global variable $browser instead, so I can
access it from the Formatter, but I'm not happy with global variables.

After fiddling around a little I thought that maybe someone has better
solution for the above mentioned problem.


More information about the rspec-users mailing list