Sha256: 934666e9d62fffa8ccf6abd1413978d5ff8c0310609addc5df4594fb9f2945b4

Contents?: true

Size: 1.88 KB

Versions: 5

Compression:

Stored size: 1.88 KB

Contents

require 'pio/open_flow10/enqueue'

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

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

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

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

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

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

    context 'with port: :in_port, queue_id: 2' do
      When(:enqueue) do
        Pio::OpenFlow10::Enqueue.new(port: :in_port, queue_id: 2)
      end

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

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

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

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pio-0.30.1 spec/pio/open_flow10/enqueue_spec.rb
pio-0.30.0 spec/pio/open_flow10/enqueue_spec.rb
pio-0.29.0 spec/pio/open_flow10/enqueue_spec.rb
pio-0.28.1 spec/pio/open_flow10/enqueue_spec.rb
pio-0.28.0 spec/pio/open_flow10/enqueue_spec.rb