Sha256: 64161e1f1c6dbdd9785de514ca3b1fa4714ff0eaae828b38cc2da53fa83da6af

Contents?: true

Size: 828 Bytes

Versions: 10

Compression:

Stored size: 828 Bytes

Contents

require_relative '../spec_helper'

describe Angelo::Stash do

  describe 'error handling' do

    class ErrorSocket

      def read *args
        raise IOError
      end

      def closed?
        true
      end

    end

    class TestStash
      extend Angelo::Stash::ClassMethods
      include Angelo::Stash

      def << s
        peeraddrs[s] = [nil, 'hi from tests']
        stashes[@context] << s
      end

    end

    it 'does not skip live sockets when removing dead sockets' do
      err_sock = ErrorSocket.new

      good_sock = Minitest::Mock.new
      good_sock.expect :read, "hi"
      good_sock.expect :hash, 123
      def good_sock.== o; o == self; end

      stash = TestStash.new nil

      stash << err_sock
      stash << good_sock

      stash.each {|s| s.read}
      good_sock.verify
    end

  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
angelo-0.4.1 test/angelo/stash_spec.rb
angelo-0.4.0 test/angelo/stash_spec.rb
angelo-0.3.3 test/angelo/stash_spec.rb
angelo-0.3.2 test/angelo/stash_spec.rb
angelo-0.3.1 test/angelo/stash_spec.rb
angelo-0.3.0 test/angelo/stash_spec.rb
angelo-0.2.4 test/angelo/stash_spec.rb
angelo-0.2.3 test/angelo/stash_spec.rb
angelo-0.2.2 test/angelo/stash_spec.rb
angelo-0.2.1 test/angelo/stash_spec.rb