mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Merge pull request #1197 from twalpole/quit
Ensure browser gets cleared when Capybara::Selenium::Driver#quit is called
This commit is contained in:
commit
636391e6de
2 changed files with 19 additions and 0 deletions
|
@ -152,6 +152,8 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
@browser.quit if @browser
|
||||
rescue Errno::ECONNREFUSED
|
||||
# Browser must have already gone
|
||||
ensure
|
||||
@browser = nil
|
||||
end
|
||||
|
||||
def invalid_element_errors
|
||||
|
|
|
@ -57,3 +57,20 @@ describe Capybara::Session do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe Capybara::Selenium::Driver do
|
||||
before do
|
||||
@driver = Capybara::Selenium::Driver.new(TestApp, browser: :firefox)
|
||||
end
|
||||
|
||||
describe '#quit' do
|
||||
it "should reset browser when quit" do
|
||||
@driver.browser.should be
|
||||
@driver.quit
|
||||
#access instance variable directly so we don't create a new browser instance
|
||||
@driver.instance_variable_get(:@browser).should be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue