<commit_before>require 'pcap/handler'

require 'spec_helper'
require 'helpers/dumps'
require 'handler_examples'

describe PCap::Handler do
  describe "offline" do
    before(:all) do
      @pcap = PCap.open_offline(dump_path('simple_tcp'))
    end

    after(:all) do
      @pcap.close
    end

    it_should_behave_like "Handler"

    it "should return a nil if there are no packets left in the dump file" do
      @pcap.loop

      header, data = @pcap.next

      header.should be_nil<commit_msg>Reopen the pcap handler for the dumpfile after every spec.<commit_after>require 'pcap/handler'

require 'spec_helper'
require 'helpers/dumps'
require 'handler_examples'

describe PCap::Handler do
  describe "offline" do
    before(:each) do
      @pcap = PCap.open_offline(dump_path('simple_tcp'))
    end

    after(:each) do
      @pcap.close
    end

    it_should_behave_like "Handler"

    it "should return a nil if there are no packets left in the dump file" do
      @pcap.loop

      header, data = @pcap.next

      header.should be_nil
{'fraction_non_alphanumeric': 0.08708133971291866, 'fraction_numerical': 0.0, 'mean_word_length': 3.2348178137651824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '312525', 'n_tokens_mistral': 351, 'n_tokens_neox': 338, 'n_words': 102}