Sha256: 52d23fb8f19af783866a62f6d3324fafb977ef25837c715aa05ab8333cfc2145

Contents?: true

Size: 731 Bytes

Versions: 10

Compression:

Stored size: 731 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))

with_rackup('thread_safety.ru') do
  Shindo.tests('Excon thread safety') 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'
    }

    long_thread.join
    short_thread.join

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
excon-0.6.0 tests/thread_safety_tests.rb
excon-0.5.8 tests/thread_safety_tests.rb
excon-0.5.7 tests/thread_safety_tests.rb
excon-0.5.6 tests/thread_safety_tests.rb
excon-0.5.5 tests/thread_safety_tests.rb
excon-0.5.4 tests/thread_safety_tests.rb
excon-0.5.3 tests/thread_safety_tests.rb
excon-0.5.2 tests/thread_safety_tests.rb
excon-0.5.1 tests/thread_safety_tests.rb
excon-0.5.0 tests/thread_safety_tests.rb