<commit_before>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')


describe "Rubyack" do

  before { @text_searcher = RubyAck::TextSearcher.new }

  it 'should invoke ack with the arguments in quotes' do
    @text_searcher.invoker.should_receive(:invoke).with("\"def foo\"")
    @text_searcher.search("def foo")
  end

  it "should be to return the lines found" do
    @text_searcher.invoker.stub!(:invoke).with("\"factory\"").and_return(["admission/robot/lib/factory.rb:3:  def initialize(map)\n"])
    lines = @text_searcher.search("factory")
    lines.size.should == 1

    first_result = lines.first
    first_result.number.should == 3
  end

  describe "Parsing results" do
    include RubyAck

    it "should return an empty array if no result is found" do
      ResultsParser.parse([]).should be_empty
    end

    it "should parse a result with 1 line" do
      result_line = ResultsParser.parse(["admission/robot/lib/factory.rb:3:123:  def initialize(map)\n"]).first

      result_line.number.should == 3
      result_line.column.should. == 123
      result_line.text.should == "def initialize(map)"
      result_line.file.should == 'admission/robot/lib/factory.rb'
    end

    it "should be able to parse multiple results" do
      results = ResultsParser.parse(["admission/robot/lib/factory.rb:3:  def initialize(map)\n",
                                     "admission/travel/rdoc/Flight.html:363:50:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">total_duration</span>\n"])
      results.size.should ==  2
    end

  end
end
<commit_msg>Removed last non necessary include in tests<commit_after>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')


describe "Rubyack" do

  before { @text_searcher = RubyAck::TextSearcher.new }

  it 'should invoke ack with the arguments in quotes' do
    @text_searcher.invoker.should_receive(:invoke).with("\"def foo\"")
    @text_searcher.search("def foo")
  end

  it "should be to return the lines found" do
    @text_searcher.invoker.stub!(:invoke).with("\"factory\"").and_return(["admission/robot/lib/factory.rb:3:  def initialize(map)\n"])
    lines = @text_searcher.search("factory")
    lines.size.should == 1

    first_result = lines.first
    first_result.number.should == 3
  end

  describe "Parsing results" do

    it "should return an empty array if no result is found" do
      RubyAck::ResultsParser.parse([]).should be_empty
    end

    it "should parse a result with 1 line" do
      result_line = RubyAck::ResultsParser.parse(["admission/robot/lib/factory.rb:3:123:  def initialize(map)\n"]).first

      result_line.number.should == 3
      result_line.column.should. == 123
      result_line.text.should == "def initialize(map)"
      result_line.file.should == 'admission/robot/lib/factory.rb'
    end

    it "should be able to parse multiple results" do
      results = RubyAck::ResultsParser.parse(["admission/robot/lib/factory.rb:3:  def initialize(map)\n",
                                     "admission/travel/rdoc/Flight.html:363:50:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">total_duration</span>\n"])
      results.size.should ==  2
    end

  end
end

{'fraction_non_alphanumeric': 0.13184772516248838, 'fraction_numerical': 0.011761064685855771, 'mean_word_length': 3.3499327052489907, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5408085', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1021, 'n_words': 230}