Sha256: f47d9b58cdc0ac2382a702691aae5bbd8523e623da474b567e937d295a2d9960

Contents?: true

Size: 898 Bytes

Versions: 4

Compression:

Stored size: 898 Bytes

Contents

require "spec_helper"

describe AwsInventory::SecurityGroup::Open do
  let(:reporter) { AwsInventory::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

4 entries across 4 versions & 1 rubygems

Version Path
aws-inventory-0.4.5 spec/lib/aws_inventory/security_group/open_spec.rb
aws-inventory-0.4.3 spec/lib/aws_inventory/security_group/open_spec.rb
aws-inventory-0.4.2 spec/lib/aws_inventory/security_group/open_spec.rb
aws-inventory-0.4.0 spec/lib/aws_inventory/security_group/open_spec.rb