If you want all examples in a particular context to share an object, the easiest way is to use before(:context) to initialize it and store it in an instance variable, and then use that instance variable from your examples. Here’s an example:
context "my context" doi
before(:context) { @browser = Watir::Browser.new :firefox }
it "uses the browser" do
@browser.do_something
end
it "uses the browser for something else" do
@browser.do_something_else
end
end
HTH,
Myron
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscribe@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/d3279bff-ed2c-4983-b6a6-cf7c36df7c04%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.