lib/taza/site.rb in taza-0.8.5 vs lib/taza/site.rb in taza-0.8.6
- old
+ new
@@ -16,10 +16,11 @@
# class Google < Taza::Site
#
# end
class Site
@@before_browser_closes = Proc.new() {}
+ @@donot_close_browser = false
# Use this to do something with the browser before it closes, but note that it is a class method which
# means that this will get called for any instance of a site.
#
# Here's an example of how you might use it to print the DOM output of a browser before it closes:
#
@@ -27,10 +28,14 @@
# puts browser.html
# end
def self.before_browser_closes(&block)
@@before_browser_closes = block
end
+
+ def self.donot_close_browser
+ @@donot_close_browser = true
+ end
attr_accessor :browser
# A site can be called a few different ways
#
# The following example creates a new browser object and closes it:
@@ -79,10 +84,10 @@
Taza::Settings.site_file(self.name.to_s.split("::").last)
end
def close_browser_and_raise_if original_error # :nodoc:
begin
- @browser.close if @i_created_browser
+ @browser.close if (@i_created_browser && !@@donot_close_browser)
ensure
raise original_error if original_error
end
end