> Why do you want before(:all)? Generally it's use is disregarded, just
> as global variables are considered harmful, not because they can't be
> used well, but because 99% of the times they aren't.
Because I want to be able to create a single @browser object at the
beginning
of my tests and have it passed to all examples. Without nested
examples, that
works just fine - I can create my browser instance in the before(:all)
block and
avoid using a global variable. In nested examples, I don't see a good
way to
do that - I could always set up the browser instance as a global (did
that in
the past with Test::Unit and many Watir users do so) but I'd like to
avoid this.
If I didn't use a before(:all) block or a global variable, would there
be any way to
pass my browser object to all example groups?
Currently my tests look like this:
describe "A series of tests" do
before(:all) do
@browser = Watir::Browser.new
end
it "Test 1: it should go to www.google.com" do
@browser.goto("www.google.com")
end
end
Obviously, been able to use nested describe groups would make the
tests easier
to read for non-coders here and that's why I wanted to use them...
Regards,
John
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users