Sha256: 762b4afcdd3b79e8275145759271bbb18e70075799b8cb6cf79a3dfb9007ff5a

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

require 'spec_helper'
require 'nmap/task'

describe Task do
  describe "#ports=" do
    it "should ignore empty port Arrays" do
      subject.ports = []

      expect(subject.arguments).to eq([])
    end

    it "should format a String of ports" do
      subject.ports = '80,21,25'

      expect(subject.arguments).to eq(%w[-p 80,21,25])
    end

    it "should format an Array of String ports" do
      subject.ports = %w[80 21 25]

      expect(subject.arguments).to eq(%w[-p 80,21,25])
    end

    it "should format an Array of Integer ports" do
      subject.ports = [80, 21, 25]

      expect(subject.arguments).to eq(%w[-p 80,21,25])
    end

    it "should format a Range of ports" do
      subject.ports = [80, 21..25]

      expect(subject.arguments).to eq(%w[-p 80,21-25])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-nmap-0.9.2 spec/task_spec.rb
ruby-nmap-0.9.1 spec/task_spec.rb
ruby-nmap-0.9.0 spec/task_spec.rb
ruby-nmap-0.8.0 spec/task_spec.rb