Sha256: f9870ec99789515ac09e1c88bdb2618abd9719172336a932f9dd4c6f98d8f162

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 Bytes

Contents

require 'test_helper'

module Vedeu
  describe Buffer do
    let(:vars) {
      {
        back: '',
        front: '',
        interface: mock('Interface'),
      }
    }

    describe '#initialize' do
      it 'returns a Buffer instance when all the vars are set' do
        #vars = { name: 'interface', clear: '', current: '', group: '', next: '' }
        Buffer.new(vars).must_be_instance_of(Buffer)
      end

      it 'raises an exception if a var is not set' do
        vars = {}
        proc { Buffer.new(vars) }.must_raise(KeyError)
      end
    end

    describe '#enqueue' do
      it 'creates a new Buffer instance with the sequence assigned to @_next' do
        buffer     = Buffer.new(vars)
        new_buffer = buffer.enqueue('some_sequence')

        buffer.back.must_equal('')
        new_buffer.wont_equal(buffer)
        new_buffer.back.must_equal('some_sequence')
      end
    end

    describe '#refresh' do
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.1.17 test/lib/vedeu/support/buffer_test.rb
vedeu-0.1.16 test/lib/vedeu/support/buffer_test.rb