Sha256: 9bc82a81ee94df796ca0e52855ea69cd9052b8bbaa442446f5dc9a76f2dc1184

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require_relative '../../../test_helper'

module Vedeu
  describe Queue do
    let(:described_class) { Queue }

    before do
      described_class.clear
    end

    describe '.dequeue' do
      let(:subject) { described_class.dequeue }

      context 'when the queue is empty' do
        it { subject.must_be_instance_of(NilClass) }
      end

      context 'when the queue is not empty' do
        before { described_class.enqueue(:result) }

        it { subject.must_be_instance_of(Symbol) }
      end
    end

    describe '.enqueue' do
      let(:subject) { described_class.enqueue(result) }
      let(:result)  { :result }

      it { subject.must_be_instance_of(Array) }

      it { subject.size.must_equal(1) }
    end

    describe '.size' do
      let(:subject) { described_class.size }

      it { subject.must_be_instance_of(Fixnum) }
    end

    describe '.clear' do
      let(:subject) { described_class.clear }

      it { subject.must_be_instance_of(Array) }

      it { subject.must_be_empty }
    end

    describe '.view' do
      let(:subject) { described_class.view }

      it { subject.must_be_instance_of(String) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.13 test/lib/vedeu/process/queue_test.rb