Sha256: bd10e0940dec9a6345a7863da24d2ee7d6e81c0e7bb18833938334c1992e7d22

Contents?: true

Size: 1.41 KB

Versions: 12

Compression:

Stored size: 1.41 KB

Contents

require 'test_helper'

module Vedeu

  describe VirtualBuffers do

    let(:described) { Vedeu::VirtualBuffers }

    before { described.clear }

    describe '#retrieve' do
      subject { described.retrieve }

      context 'when no buffers are stored' do
        it { subject.must_be_instance_of(NilClass) }
      end

      context 'when buffers are stored' do
        let(:buffer) { [[Vedeu::Views::Char.new]] }

        before { described.store(buffer) }

        it { subject.must_be_instance_of(Array) }

        it { subject.must_equal(buffer) }

        it 'removes the stored buffer from the storage' do
          described.size.must_equal(1)
          subject
          described.size.must_equal(0)
        end
      end
    end

    describe '#store' do
      let(:data) { :data }

      subject { described.store(data) }

      it { subject.must_be_instance_of(Array) }

      it { subject.must_equal([:data]) }

      it 'adds the buffer (data) to the storage' do
        described.size.must_equal(0)
        subject
        described.size.must_equal(1)
      end
    end

    describe '#size' do
      subject { described.size }

      it { subject.must_be_instance_of(Fixnum) }
    end

    describe '#clear' do
      subject { described.clear }

      it { subject.must_be_instance_of(Array) }

      it { subject.must_be_empty }

      it { described.must_respond_to(:reset) }
    end

  end # VirtualBuffers

end # Vedeu

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vedeu-0.6.8 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.7 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.6 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.5 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.4 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.3 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.2 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.1 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.6.0 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.5.13 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.5.12 test/lib/vedeu/buffers/virtual_buffers_test.rb
vedeu-0.5.11 test/lib/vedeu/buffers/virtual_buffers_test.rb