<commit_before>require 'spec_helper'

describe Alephant::Sequencer do
  subject { Alephant::Sequencer }

  describe "initialize(opts, id)" do
    it "sets @id, @table_name and @table_conf" do
      sleep_until_table_active = double()

      Alephant::Sequencer.any_instance.stub(:sleep_until_table_active).and_return(sleep_until_table_active);

      AWS::DynamoDB.any_instance.stub(:initialize).and_return({
        :tables => :table_name
      })

      instance = subject.new({
        :table_name => :table_name,
        :table_conf => :table_conf
      }, :sqs_queue_id)

      expect(instance.id).to eq(:sqs_queue_id)
      expect(instance.table_name).to eq(:table_name)
      expect(instance.table_conf).to eq(:table_conf)
    end
  end
end
<commit_msg>Add test for sequential?() method<commit_after>require 'spec_helper'

describe Alephant::Sequencer do
  subject { Alephant::Sequencer }

  describe "initialize(opts, id)" do
    it "sets @id, @table_name and @table_conf" do
      sleep_until_table_active = double()

      Alephant::Sequencer.any_instance.stub(:sleep_until_table_active).and_return(sleep_until_table_active);

      AWS::DynamoDB.any_instance.stub(:initialize).and_return({
        :tables => :table_name
      })

      instance = subject.new({
        :table_name => :table_name,
        :table_conf => :table_conf
      }, :sqs_queue_id)

      expect(instance.id).to eq(:sqs_queue_id)
      expect(instance.table_name).to eq(:table_name)
      expect(instance.table_conf).to eq(:table_conf)
    end

  describe "sequential?(data)" do
    before(:each) do
      Alephant::Sequencer
        .any_instance.stub(:initialize)
        .and_return(double())
    end

    context "block provided" do
      it "yields to block" do
        Alephant::Sequencer
          .any_instance
          .stub(:get_last_seen)
          .and_return(1)

        instance = subject.new

        test = instance.sequential?(:data) do |last_seen, data|
          :foo
        end

        expect(test).to eq(:foo)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11474609375, 'fraction_numerical': 0.00048828125, 'mean_word_length': 3.033464566929134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '774830', 'n_tokens_mistral': 665, 'n_tokens_neox': 654, 'n_words': 119}