Sha256: f44473b31d6c6ebeb605f5f221f811b9f9e46b77ccc3e8b08b5d5d5a7952b468

Contents?: true

Size: 843 Bytes

Versions: 26

Compression:

Stored size: 843 Bytes

Contents

require 'test_helper'

class ThreadTest < Test::Unit::TestCase

  context "when logging multiple requests at once" do
    setup do
      @log = StringIO.new
      Samuel.logger = Logger.new(@log)
      FakeWeb.register_uri(:get, /example\.com/, :status => [200, "OK"])
      threads = []
      5.times do |i|
        threads << Thread.new(i) do |n|
          Samuel.with_config :label => "Example #{n}" do
            Thread.pass
            open "http://example.com/#{n}"
          end
        end
      end
      threads.each { |t| t.join }
      @log.rewind
    end

    should "not let configuration blocks interfere with eachother" do
      @log.each_line do |line|
        matches = %r|Example (\d+).*example\.com/(\d+)|.match(line)
        assert_not_nil matches
        assert_equal matches[1], matches[2]
      end
    end
  end

end

Version data entries

26 entries across 26 versions & 8 rubygems

Version Path
chrisk-samuel-0.2.0 test/thread_test.rb
chrisk-samuel-0.2.1 test/thread_test.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/thread_test.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/thread_test.rb
putio-0.0.1.pre2 development/ruby/1.8/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/thread_test.rb
putio-0.0.1.pre development/ruby/1.8/gems/fakeweb-1.3.0/test/vendor/samuel-0.2.1/test/thread_test.rb
cotweet-fakeweb-1.3.0 test/vendor/samuel-0.2.1/test/thread_test.rb
fakeweb-1.3.0 test/vendor/samuel-0.2.1/test/thread_test.rb
corntrace-fakeweb-1.2.9 test/vendor/samuel-0.2.1/test/thread_test.rb
webmock-1.0.0 spec/vendor/samuel-0.2.1/test/thread_test.rb
webmock-0.9.1 spec/vendor/samuel-0.2.1/test/thread_test.rb
webmock-0.9.0 spec/vendor/samuel-0.2.1/test/thread_test.rb
webmock-0.8.2 spec/vendor/samuel-0.2.1/test/thread_test.rb
webmock-0.8.1 spec/vendor/samuel-0.2.1/test/thread_test.rb
samuel-0.3.2 test/thread_test.rb
samuel-0.3.1 test/thread_test.rb
samuel-0.3.0 test/thread_test.rb
fakeweb-1.2.8 test/vendor/samuel-0.2.1/test/thread_test.rb
webmock-0.8.0 spec/vendor/samuel-0.2.1/test/thread_test.rb
webmock-0.7.3 spec/vendor/samuel-0.2.1/test/thread_test.rb