On Sun, Oct 18, 2009 at 1:36 PM, Jarmo Pertman <jarm...@gmail.com> wrote:
> Hello. > > 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. > # in the example it "does something" do options[:browser] = Selenium.new(...) ... end # in the formatter def example_started(example) example.options[:browser] # => same browser created in the example end HTH, David Jarmo >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users