test fixes

This commit is contained in:
Thomas Walpole 2018-05-11 12:37:45 -07:00
parent 3de215400e
commit 54ca647a1f
3 changed files with 18 additions and 5 deletions

View File

@ -20,6 +20,7 @@ module Capybara
def initialize
@session_options = Capybara::SessionConfig.new
@javascript_driver = nil
end
attr_writer :reuse_server

View File

@ -1,15 +1,15 @@
# frozen_string_literal: true
class NodeWrapper
def initialize(element); @element = element end
def to_capybara_node(); @element end
end
Capybara::SpecHelper.spec "#to_capybara_node" do
before do
@session.visit('/with_html')
end
class NodeWrapper
def initialize(element); @element = element end
def to_capybara_node(); @element end
end
it "should support have_xxx expectations" do
para = NodeWrapper.new(@session.find(:css, '#first'))
expect(para).to have_link("ullamco")

View File

@ -18,6 +18,12 @@ RSpec.describe Capybara::Session do
end
context "current_driver" do
around do |example|
orig_driver = Capybara.current_driver
example.run
Capybara.current_driver = orig_driver
end
it "is global when threadsafe false" do
Capybara.threadsafe = false
Capybara.current_driver = :selenium
@ -40,6 +46,12 @@ RSpec.describe Capybara::Session do
end
context "session_name" do
around do |example|
orig_name = Capybara.session_name
example.run
Capybara.session_name = orig_name
end
it "is global when threadsafe false" do
Capybara.threadsafe = false
Capybara.session_name = "sess1"