Created
October 24, 2011 17:14
-
-
Save cs3b/1309547 to your computer and use it in GitHub Desktop.
Patch for rspec runner - to handle firefox freezzing [ done in spirit of monkey see monkey path - use on your own risk :-)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RSpec | |
module Core | |
class Example | |
def run(example_group_instance, reporter) | |
@example_group_instance = example_group_instance | |
@example_group_instance.example = self | |
start(reporter) | |
execution_attempt = 0 | |
begin | |
unless pending | |
with_pending_capture do | |
with_around_hooks do | |
begin | |
run_before_each | |
@example_group_instance.instance_eval(&@example_block) | |
rescue Exception => e | |
execution_attempt += 1 | |
if e.is_a?(Timeout::Error) and Capybara.current_driver == :selenium | |
Capybara.current_session.driver.browser.quit | |
Capybara.current_session.driver.instance_variable_set(:@browser, nil) | |
if execution_attempt < 2 | |
redo | |
else | |
set_exception(e) | |
end | |
else | |
set_exception(e) | |
end | |
ensure | |
run_after_each | |
end | |
end | |
end | |
end | |
rescue Exception => e | |
set_exception(e) | |
ensure | |
@example_group_instance.example = nil | |
assign_auto_description | |
end | |
finish(reporter) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment