mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add Session#quit
This commit is contained in:
parent
9ce269c3ba
commit
0fe411a6da
2 changed files with 21 additions and 0 deletions
|
@ -134,6 +134,18 @@ module Capybara
|
||||||
alias_method :cleanup!, :reset!
|
alias_method :cleanup!, :reset!
|
||||||
alias_method :reset_session!, :reset!
|
alias_method :reset_session!, :reset!
|
||||||
|
|
||||||
|
##
|
||||||
|
#
|
||||||
|
# Disconnect from the current driver. A new driver will be instantiated on the next interaction
|
||||||
|
#
|
||||||
|
#
|
||||||
|
def quit
|
||||||
|
@driver.quit if @driver.respond_to? :quit
|
||||||
|
@driver = nil
|
||||||
|
@touched = false
|
||||||
|
@server&.reset_error!
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
# Raise errors encountered in the server
|
# Raise errors encountered in the server
|
||||||
|
|
|
@ -72,4 +72,13 @@ RSpec.describe Capybara::Session do
|
||||||
expect(Capybara.session_name).to eq 'sess1'
|
expect(Capybara.session_name).to eq 'sess1'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'quit' do
|
||||||
|
it 'will reset the driver' do
|
||||||
|
session = Capybara::Session.new(:rack_test, TestApp)
|
||||||
|
driver = session.driver
|
||||||
|
session.quit
|
||||||
|
expect(session.driver).not_to eql driver
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue