Sha256: dc8fbc9dbaa21c01c8440517c92fdf72b4289de41cb1f3ffb708f30f83add499

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require 'spec_helper'
describe Qfill::ListSet do
  describe '#new' do
    context 'with no arguments' do
      it 'raises ArgumentError' do
        expect { described_class.new }.to raise_error(ArgumentError)
      end
    end

    context 'with arguments' do
      before do
        @filter = Qfill::Filter.new(->(object) { object.is_a?(Numeric) })
        @origin_queues = [
          Qfill::List.new(
            name: 'High List',
            elements: [1, 2, 3, 'c'],
            filter: @filter
          ),
          Qfill::List.new(name: 'Medium List',
                          elements: ['e', 'f', 4, 5],
                          filter: @filter),
          Qfill::List.new(name: 'Low List',
                          elements: [7, 8, 'd'],
                          filter: @filter)
        ]
      end

      it 'does not raise any errors' do
        expect { described_class.new(*@origin_queues) }.not_to raise_error
      end

      it 'instantiates with name' do
        popper = described_class.new(*@origin_queues)
        expect(popper.queues.first.elements).to eq([1, 2, 3, 'c'])
        expect(popper.queues.last.elements).to eq([7, 8, 'd'])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qfill-0.1.1 spec/qfill/list_set_spec.rb
qfill-0.1.0 spec/qfill/list_set_spec.rb