# -*- coding:binary -*-
require 'spec_helper'

require 'msf/core'
require 'msf/core/module'
require 'msf/core/exploit/capture'

describe Msf::Exploit::Capture do

  subject do
    mod = Msf::Module.new
    mod.extend described_class
    mod
  end

  it 'should be a kind of Msf::Exploit::Capture' do
    subject.should be_a_kind_of Msf::Exploit::Capture
  end

  context '#stats_*' do

    it 'should show received packets' do
      subject.stats_recv.should == 0
    end

    it 'should show dropped packets' do
      subject.stats_drop.should == 0
    end

    it 'should show interface-dropped packets' do
      subject.stats_ifdrop.should == 0
    end

  end

  it 'should respond to open_pcap' do
    subject.should respond_to :open_pcap
  end

  it 'should confirm that pcaprub is available', :pending => "Need to test this without stubbing check_pcaprub_loaded" do
  end

  it 'should open a pcap file', :pending => "Provde a sample pcap file to read" do
  end

  it 'should capture from an iface', :pending => "Mock this? Tends to need root" do
  end

  it 'should inject packets to an ifrace', :pending => "Mock this? Tends to need root" do
  end

end

