Skip to content

Commit

Permalink
Merge pull request #1197 from twalpole/quit
Browse files Browse the repository at this point in the history
Ensure browser gets cleared when Capybara::Selenium::Driver#quit is called
  • Loading branch information
twalpole committed Nov 23, 2013
2 parents 7caa242 + 02045d2 commit 636391e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/capybara/selenium/driver.rb
Expand Up @@ -152,6 +152,8 @@ def quit
@browser.quit if @browser
rescue Errno::ECONNREFUSED
# Browser must have already gone
ensure
@browser = nil
end

def invalid_element_errors
Expand Down
17 changes: 17 additions & 0 deletions spec/selenium_spec.rb
Expand Up @@ -57,3 +57,20 @@ module TestSessions
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


0 comments on commit 636391e

Please sign in to comment.