Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure browser gets cleared when Capybara::Selenium::Driver#quit is called #1197

Merged
merged 1 commit into from
Nov 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/capybara/selenium/driver.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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