Sha256: ba1e32e6f3886cf15cfcae454502e8ed8f454cf857307d8ac987ed2272c663f3

Contents?: true

Size: 1000 Bytes

Versions: 4

Compression:

Stored size: 1000 Bytes

Contents

require 'spec_helper'
include DeadlySerious::Engine

describe AutoPipe do
  subject { AutoPipe.new }
  describe '#last' do
    it 'returns last writer' do
      subject.next
      expect(subject.last).to eq 'pipe.0001'
    end

    it 'returns nil if no last writer' do
      expect(subject.last).to be_nil
    end
  end

  describe '#next' do
    it 'returns next writer name' do
      expect(subject.next).to eq 'pipe.0001'
      expect(subject.next).to eq 'pipe.0002'
    end
  end

  describe '#on_subnet' do
    it 'creates "subnames" to avoid conflicts' do
      subject.next
      subject.on_subnet do
        expect(subject.next).to eq 'pipe.0001.0001'
        expect(subject.last).to eq 'pipe.0001.0001'
        expect(subject.next).to eq 'pipe.0001.0002'
        subject.on_subnet do
          expect(subject.next).to eq 'pipe.0001.0002.0001'
        end
      end
      subject.next
      subject.on_subnet do
        expect(subject.next).to eq 'pipe.0002.0001'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deadly_serious-2.0.0.pre.rc4 spec/lib/deadly_serious/engine/auto_pipe_spec.rb
deadly_serious-2.0.0.pre.rc3 spec/lib/deadly_serious/engine/auto_pipe_spec.rb
deadly_serious-2.0.0.pre.rc2 spec/lib/deadly_serious/engine/auto_pipe_spec.rb
deadly_serious-2.0.0.pre.rc1 spec/lib/deadly_serious/engine/auto_pipe_spec.rb