Sha256: 8091943066affaf60576294f2e5cc1d2e35e83e2916a6bcfed1439e1ff47a63d

Contents?: true

Size: 1.05 KB

Versions: 40

Compression:

Stored size: 1.05 KB

Contents

Shindo.tests('Excon thread safety') do
  
  tests('thread_safe_sockets configuration') do
    tests('thread_safe_sockets default').returns(true) do
      connection = Excon.new('http://foo.com')
      connection.data[:thread_safe_sockets]
    end

    tests('with thread_safe_sockets set false').returns(false) do
      connection = Excon.new('http://foo.com', :thread_safe_sockets => false)
      connection.data[:thread_safe_sockets]
    end
  end

  with_rackup('thread_safety.ru') do
    connection = Excon.new('http://127.0.0.1:9292')

    long_thread = Thread.new {
      response = connection.request(:method => 'GET', :path => '/id/1/wait/2')
      Thread.current[:success] = response.body == '1'
    }

    short_thread = Thread.new {
      response = connection.request(:method => 'GET', :path => '/id/2/wait/1')
      Thread.current[:success] = response.body == '2'
    }

    test('long_thread') do
      long_thread.join
      short_thread.join

      long_thread[:success]
    end

    test('short_thread') do
      short_thread[:success]
    end
  end
end

Version data entries

40 entries across 38 versions & 4 rubygems

Version Path
excon-0.64.0 tests/thread_safety_tests.rb
excon-0.63.0 tests/thread_safety_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/excon-0.62.0/tests/thread_safety_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/excon-0.62.0/tests/thread_safety_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/excon-0.62.0/tests/thread_safety_tests.rb
excon-0.62.0 tests/thread_safety_tests.rb
excon-0.61.0 tests/thread_safety_tests.rb
excon-0.60.0 tests/thread_safety_tests.rb
excon-0.59.0 tests/thread_safety_tests.rb
excon-0.58.0 tests/thread_safety_tests.rb
excon-0.57.1 tests/thread_safety_tests.rb
excon-0.57.0 tests/thread_safety_tests.rb
excon-0.56.0 tests/thread_safety_tests.rb
excon-0.55.0 tests/thread_safety_tests.rb
excon-0.54.0 tests/thread_safety_tests.rb
excon-0.53.0 tests/thread_safety_tests.rb
excon-0.52.0 tests/thread_safety_tests.rb
excon-0.51.0 tests/thread_safety_tests.rb
excon-0.50.1 tests/thread_safety_tests.rb
excon-0.50.0 tests/thread_safety_tests.rb