Sha256: efb075c0df4927b8fcb5be6ca50575162ebbad78e2d25b7efaebc94f196a43a0

Contents?: true

Size: 1.87 KB

Versions: 8

Compression:

Stored size: 1.87 KB

Contents

require 'pio/open_flow10/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

8 entries across 8 versions & 1 rubygems

Version Path
pio-0.25.0 spec/pio/open_flow10/enqueue_spec.rb
pio-0.24.2 spec/pio/open_flow10/enqueue_spec.rb
pio-0.24.1 spec/pio/open_flow10/enqueue_spec.rb
pio-0.24.0 spec/pio/open_flow10/enqueue_spec.rb
pio-0.23.1 spec/pio/open_flow10/enqueue_spec.rb
pio-0.23.0 spec/pio/open_flow10/enqueue_spec.rb
pio-0.22.0 spec/pio/open_flow10/enqueue_spec.rb
pio-0.21.1 spec/pio/open_flow10/enqueue_spec.rb