Sha256: 2dec6cb445c4e70081c27571691d3d10654fedb8d8ee8f43ddb1f0f4b90c183b

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'
require 'nmap/scan_task'

describe ScanTask do
  let(:name)       { 'SYN Stealth Scan' }
  let(:end_time)   { Time.now }
  let(:duration)   { 10 }
  let(:start_time) { end_time - duration }
  let(:extrainfo)  { '1000 total ports' }

  subject do
    described_class.new(
      name,
      start_time,
      end_time,
      extrainfo
    )
  end

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

    it "should be the time between the start_time and end_time" do
      expect(subject.start_time + subject.duration).to eq(subject.end_time)
    end
  end

  describe "#to_s" do
    it "should include the start_time, name and extrainfo" do
      expect(subject.to_s).to eq("#{start_time}: #{name} (#{extrainfo})")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-nmap-0.10.0 spec/scan_task_spec.rb
ruby-nmap-0.9.3 spec/scan_task_spec.rb
ruby-nmap-0.9.2 spec/scan_task_spec.rb
ruby-nmap-0.9.1 spec/scan_task_spec.rb
ruby-nmap-0.9.0 spec/scan_task_spec.rb
ruby-nmap-0.8.0 spec/scan_task_spec.rb