Sha256: 6edfc3384ea3d014b2869122001231cf26a1fa228c6c6a5b53ab31e8d7c4ffae

Contents?: true

Size: 849 Bytes

Versions: 1

Compression:

Stored size: 849 Bytes

Contents

require 'spec_helper'
require 'nmap/port'

describe Port do
  let(:xml) { XML.new(Helpers::SCAN_FILE) }

  subject { xml.hosts.first.ports.first }

  it "should parse the protocol" do
    subject.protocol.should == :tcp
  end

  it "should parse the port number" do
    subject.number.should == 21
  end

  it "should parse the state" do
    subject.state.should == :closed
  end

  it "should parse the reason" do
    subject.reason.should == 'reset'
  end

  it "should parse the detected service" do
    subject.service.name.should == 'ftp'
  end

  context "when NSE scripts are ran" do
    let(:xml) { XML.new(Helpers::NSE_FILE) }

    it "should parse the output of scripts" do
      subject.scripts.should_not be_empty

      subject.scripts.keys.should_not include(nil)
      subject.scripts.values.should_not include(nil)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-nmap-0.6.0 spec/port_spec.rb