Sha256: eb3fd8d9678a61d68e66be54c6b8b15a375704b8d1766d5fd9c68318dfbf7d3a

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'
require 'vedeu/support/queue'

module Vedeu
  describe Queue do
    before { Queue.reset }

    describe '.dequeue' do
      it 'returns a NilClass when the queue is empty' do
        Queue.dequeue.must_be_instance_of(NilClass)
      end

      it 'returns the first entry added when the queue is not empty' do
        Queue.enqueue(:result)
        Queue.dequeue.must_be_instance_of(Symbol)
      end
    end

    describe '.enqueue' do
      it 'stores an item on the queue' do
        Queue.enqueue(:result)
        Queue.enqueued?.must_equal(true)
      end
    end

    describe '.enqueued?' do
      it 'returns true when the queue is not empty' do
        Queue.enqueue(:result)
        Queue.enqueued?.must_be_instance_of(TrueClass)
      end

      it 'returns false when the queue is empty' do
        Queue.enqueued?.must_be_instance_of(FalseClass)
      end
    end

    describe '.clear' do
      it 'returns an empty array' do
        Queue.enqueue(:result)
        Queue.reset.must_be_empty
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.1.7 test/lib/vedeu/support/queue_test.rb
vedeu-0.1.6 test/lib/vedeu/support/queue_test.rb
vedeu-0.1.5 test/lib/vedeu/support/queue_test.rb
vedeu-0.1.4 test/lib/vedeu/support/queue_test.rb
vedeu-0.1.3 test/lib/vedeu/support/queue_test.rb
vedeu-0.1.2 test/lib/vedeu/support/queue_test.rb
vedeu-0.1.1 test/lib/vedeu/support/queue_test.rb