Sha256: 71816296c2f05c234aa4858452837fff1b53b4a879c03513dd0aa4b666f3f11d

Contents?: true

Size: 1.47 KB

Versions: 21

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Capybara::Session do
  it "verifies a passed app is a rack app" do
    expect do
      Capybara::Session.new(:unknown, { random: "hash"})
    end.to raise_error TypeError, "The second parameter to Session::new should be a rack app if passed."
  end

  context "current_driver" do
    it "is global when threadsafe false" do
      Capybara.threadsafe = false
      Capybara.current_driver = :selenium
      thread = Thread.new do
        Capybara.current_driver = :random
      end
      thread.join
      expect(Capybara.current_driver).to eq :random
    end

    it "is thread specific threadsafe true" do
      Capybara.threadsafe = true
      Capybara.current_driver = :selenium
      thread = Thread.new do
        Capybara.current_driver = :random
      end
      thread.join
      expect(Capybara.current_driver).to eq :selenium
    end
  end

  context "session_name" do
    it "is global when threadsafe false" do
      Capybara.threadsafe = false
      Capybara.session_name = "sess1"
      thread = Thread.new do
        Capybara.session_name = "sess2"
      end
      thread.join
      expect(Capybara.session_name).to eq "sess2"
    end

    it "is thread specific when threadsafe true" do
      Capybara.threadsafe = true
      Capybara.session_name = "sess1"
      thread = Thread.new do
        Capybara.session_name = "sess2"
      end
      thread.join
      expect(Capybara.session_name).to eq "sess1"
    end
  end
end

Version data entries

21 entries across 19 versions & 3 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/capybara-2.18.0/spec/session_spec.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/capybara-2.18.0/spec/session_spec.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/capybara-2.16.1/spec/session_spec.rb
capybara-2.18.0 spec/session_spec.rb
capybara-2.17.0 spec/session_spec.rb
tdiary-5.0.7 vendor/bundle/gems/capybara-2.16.1/spec/session_spec.rb
capybara-2.16.1 spec/session_spec.rb
capybara-2.16.0 spec/session_spec.rb
capybara-2.15.4 spec/session_spec.rb
capybara-2.15.3 spec/session_spec.rb
capybara-2.15.2 spec/session_spec.rb
tdiary-5.0.6 vendor/bundle/gems/capybara-2.15.1/spec/session_spec.rb
capybara-2.15.1 spec/session_spec.rb
capybara-2.15.0 spec/session_spec.rb
tdiary-5.0.5 vendor/bundle/gems/capybara-2.14.3/spec/session_spec.rb
capybara-2.14.4 spec/session_spec.rb
capybara-2.14.3 spec/session_spec.rb
capybara-2.14.2 spec/session_spec.rb
capybara-2.14.1 spec/session_spec.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/capybara-2.14.0/spec/session_spec.rb