Sha256: c445fb2a7f1de16db077c2331c2898ff72b171e2fa6d87aa1a5e2e81e357aa13

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

require 'pio/open_flow10/set_transport_port'

describe Pio::SetTransportSourcePort do
  describe '.new' do
    When(:set_transport_source_port) do
      Pio::SetTransportSourcePort.new port_number
    end

    context 'with 100' do
      When(:port_number) { 100 }

      describe '#port_number' do
        Then { set_transport_source_port.port_number == 100 }
      end

      describe '#type' do
        Then { set_transport_source_port.type == 9 }
      end

      describe '#message_length' do
        Then { set_transport_source_port.message_length == 8 }
      end

      describe '#to_binary' do
        Then { set_transport_source_port.to_binary.length == 8 }
      end
    end

    context 'with -1' do
      When(:port_number) { -1 }
      Then { set_transport_source_port == Failure(ArgumentError) }
    end

    context 'with 2**16' do
      When(:port_number) { 2**16 }
      Then { set_transport_source_port == Failure(ArgumentError) }
    end

    context 'with :INVALID_PORT_NUMBER' do
      When(:port_number) { :INVALID_PORT_NUMBER }
      Then { set_transport_source_port == Failure(TypeError) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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