Sha256: 4e48f8f1305c551351b32dbd58ddde1c1248d412bba9f947bb8a9e64c1fac780

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

require "spec_helper"

describe Inventory::SecurityGroup::Open do
  let(:reporter) { Inventory::SecurityGroup::Open.new({}) }

  it "combine_ports" do
    ports = [22]
    combined_ports = reporter.combine_ports(ports)
    expect(combined_ports).to eq([22])

    ports = [80, 443]
    combined_ports = reporter.combine_ports(ports)
    expect(combined_ports).to eq([80, 443])

    ports = [80, 8000..8001]
    combined_ports = reporter.combine_ports(ports)
    expect(combined_ports).to eq([80, 8000..8001])

    ports = [1..5, 3..8]
    combined_ports = reporter.combine_ports(ports)
    expect(combined_ports).to eq([1..8])

    ports = [80, 22, 443]
    combined_ports = reporter.combine_ports(ports)
    expect(combined_ports).to eq([22, 80, 443])

    ports = [8001, 8000..8002]
    combined_ports = reporter.combine_ports(ports)
    expect(combined_ports).to eq([8000..8002])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aws-inventory-0.3.2 spec/lib/inventory/security_group/open_spec.rb
aws-inventory-0.3.1 spec/lib/inventory/security_group/open_spec.rb
aws-inventory-0.3.0 spec/lib/inventory/security_group/open_spec.rb
aws-inventory-0.2.1 spec/lib/inventory/security_group/open_spec.rb
aws-inventory-0.2.0 spec/lib/inventory/security_group/open_spec.rb