Sha256: ff69cd131ae8626792ba58da91c7a408122cf9d23eeb5c8fe77711c4ffefe53f

Contents?: true

Size: 724 Bytes

Versions: 10

Compression:

Stored size: 724 Bytes

Contents

require 'jellyfish/test'

describe Jellyfish do
  after do
    Muack.verify
  end

  app = Class.new{
    include Jellyfish
    handle(StandardError){ |env| 0 }
  }.new

  exp = RuntimeError.new

  would "no RuntimeError: can't add a new key into hash during iteration" do
    # make static ancestors so that we could stub it
    ancestors = RuntimeError.ancestors
    stub(RuntimeError).ancestors{ancestors}
    flip = true
    stub(ancestors).index(anything).peek_return do |i|
      if flip
        flip = false
        sleep 0.0001
      end
      i
    end

    2.times.map{
      Thread.new do
        app.send(:best_handler, exp).call({}).should.eq 0
      end
    }.each(&:join)

    flip.should.eq false
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jellyfish-1.4.0 test/test_threads.rb
jellyfish-1.3.1 test/test_threads.rb
jellyfish-1.3.0 test/test_threads.rb
jellyfish-1.2.2 test/test_threads.rb
jellyfish-1.2.1 test/test_threads.rb
jellyfish-1.2.0 test/test_threads.rb
jellyfish-1.1.1 test/test_threads.rb
jellyfish-1.1.0 test/test_threads.rb
jellyfish-1.0.2 test/test_threads.rb
jellyfish-1.0.1 test/test_threads.rb