We reset the phantom js driver after each context to prevent it memory leaking and dying

This commit is contained in:
Andy Palmer
2017-11-02 12:49:58 +11:00
committed by Rob H
parent 7b8463b03a
commit 3bd4fc59d4

View File

@@ -90,6 +90,14 @@ RSpec.configure do |config|
DatabaseCleaner.clean
end
def restart_phantomjs
Capybara.send('session_pool').values
.select { |s| s.driver.is_a?(Capybara::Poltergeist::Driver) }
.each { |driver| driver.restart}
end
config.before(:all) { restart_phantomjs }
# Geocoding
config.before(:each) { allow_any_instance_of(Spree::Address).to receive(:geocode).and_return([1,1]) }