Sha256: f0efa6c558cd8cf62316de06f005d1843f56e4915dd9ae6586afcd6de4d00b34

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'
require 'nikto/xml/item'
require 'nokogiri'

describe Nikto::XML::Item do
  let(:fixtures_dir) { File.expand_path(File.join(__dir__,'..','fixtures')) }
  let(:path) { File.join(fixtures_dir,'nikto.xml') }
  let(:xml)  { File.read(path) }
  let(:doc)  { Nokogiri::XML(File.open(path)) }
  let(:node) { doc.at_xpath('/niktoscan/scandetails/item') }

  subject { described_class.new(node) }

  describe "#description" do
    subject { super().description }

    it "must return a String" do
      expect(subject).to be_kind_of(String)
    end

    it "must return the inner text of the 'description' child element" do
      expect(subject).to eq(node.at_xpath('description').inner_text)
    end
  end

  describe "#uri" do
    subject { super().uri }

    it "must return a String" do
      expect(subject).to be_kind_of(String)
    end

    it "must return the inner text of the 'uri' child element" do
      expect(subject).to eq(node.at_xpath('uri').inner_text)
    end
  end

  describe "#name_link" do
    subject { super().name_link }

    it "must return a String" do
      expect(subject).to be_kind_of(String)
    end

    it "must return the inner text of the 'namelink' child element" do
      expect(subject).to eq(node.at_xpath('namelink').inner_text)
    end
  end

  describe "#ip_link" do
    subject { super().ip_link }

    it "must return a String" do
      expect(subject).to be_kind_of(String)
    end

    it "must return the inner text of the 'iplink' child element" do
      expect(subject).to eq(node.at_xpath('iplink').inner_text)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-nikto-0.1.0 spec/xml/item_spec.rb