Sha256: 4a0621c1b59335ff4dad940531aeab7195ab9cc53366835c0587667851717c25

Contents?: true

Size: 891 Bytes

Versions: 4

Compression:

Stored size: 891 Bytes

Contents

require 'spec_helper'
require 'xml/sequence_examples'

require 'nmap/xml/tcp_sequence'

describe Nmap::XML::TcpSequence do
  subject { @xml.hosts.first.tcp_sequence }

  describe "#index" do
    it "should parse the index" do
      expect(subject.index).to be > 0
    end
  end

  describe "#description" do
    it "should parse the difficulty description" do
      expect(subject.difficulty).to eq("Good luck!")
    end
  end

  describe "#to_s" do
    let(:index_regexp) do
      /\d+/
    end

    let(:difficulty_regexp) do
      /"(Good luck!)"/
    end

    let(:values_regexp) do
      /\[\d+(, \d+){5}\]/
    end

    let(:regexp) do
      /^index=#{index_regexp} difficulty=#{difficulty_regexp} values=#{values_regexp}$/
    end

    it "should contain the description and values" do
      expect(subject.to_s).to match(regexp)
    end
  end

  it_should_behave_like "Sequence"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-nmap-1.0.3 spec/xml/tcp_sequence_spec.rb
ruby-nmap-1.0.2 spec/xml/tcp_sequence_spec.rb
ruby-nmap-1.0.1 spec/xml/tcp_sequence_spec.rb
ruby-nmap-1.0.0 spec/xml/tcp_sequence_spec.rb