Sha256: a32f437311e9c906d131419be1e50738fc6181bff9c7b9fc2c7afc7555be2bd6

Contents?: true

Size: 1.86 KB

Versions: 20

Compression:

Stored size: 1.86 KB

Contents

require 'pio/enqueue'

describe Pio::Enqueue do
  describe '.new' do
    context 'with port_number: 1, queue_id: 2' do
      When(:enqueue) { Pio::Enqueue.new(port_number: 1, queue_id: 2) }

      describe '#port_number' do
        Then { enqueue.port_number == 1 }
      end

      describe '#queue_id' do
        Then { enqueue.queue_id == 2 }
      end

      describe '#type' do
        Then { enqueue.type == 11 }
      end

      describe '#message_length' do
        Then { enqueue.message_length == 16 }
      end

      describe '#to_binary' do
        Then { enqueue.to_binary.length == 16 }
      end
    end

    context 'with port_number: :in_port, queue_id: 2' do
      When(:enqueue) { Pio::Enqueue.new(port_number: :in_port, queue_id: 2) }

      describe '#port_number' do
        Then { enqueue.port_number == :in_port }
      end
    end

    context 'with port_number: :local, queue_id: 2' do
      When(:enqueue) { Pio::Enqueue.new(port_number: :local, queue_id: 2) }
      Then { enqueue == Failure(ArgumentError) }
    end

    context 'with port_number: -1, queue_id: 2' do
      When(:enqueue) { Pio::Enqueue.new(port_number: -1, queue_id: 2) }
      Then { enqueue == Failure(ArgumentError) }
    end

    context 'with port_number: 0xff00, queue_id: 2' do
      When(:enqueue) { Pio::Enqueue.new(port_number: 0xff00, queue_id: 2) }
      Then { enqueue == Failure(ArgumentError) }
    end

    context 'with port_number: 1, queue_id: -2' do
      When(:enqueue) { Pio::Enqueue.new(port_number: 1, queue_id: -2) }
      Then { enqueue == Failure(ArgumentError) }
    end

    context 'with port_number: 1' do
      When(:enqueue) { Pio::Enqueue.new(port_number: 1) }
      Then { enqueue == Failure(ArgumentError) }
    end

    context 'with queue_id: 2' do
      When(:enqueue) { Pio::Enqueue.new(queue_id: 2) }
      Then { enqueue == Failure(ArgumentError) }
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pio-0.21.0 spec/pio/enqueue_spec.rb
pio-0.20.1 spec/pio/enqueue_spec.rb
pio-0.20.0 spec/pio/enqueue_spec.rb
pio-0.19.0 spec/pio/enqueue_spec.rb
pio-0.18.2 spec/pio/enqueue_spec.rb
pio-0.18.1 spec/pio/enqueue_spec.rb
pio-0.18.0 spec/pio/enqueue_spec.rb
pio-0.17.0 spec/pio/enqueue_spec.rb
pio-0.16.0 spec/pio/enqueue_spec.rb
pio-0.15.2 spec/pio/enqueue_spec.rb
pio-0.15.1 spec/pio/enqueue_spec.rb
pio-0.15.0 spec/pio/enqueue_spec.rb
pio-0.14.0 spec/pio/enqueue_spec.rb
pio-0.13.0 spec/pio/enqueue_spec.rb
pio-0.12.0 spec/pio/enqueue_spec.rb
pio-0.11.2 spec/pio/enqueue_spec.rb
pio-0.11.1 spec/pio/enqueue_spec.rb
pio-0.11.0 spec/pio/enqueue_spec.rb
pio-0.10.1 spec/pio/enqueue_spec.rb
pio-0.10.0 spec/pio/enqueue_spec.rb