<commit_before>require 'spec_helper'

describe ContentItem do
  before :each do
    ContentItem.stub(:setup_search!)
  end

  describe "creating" do

    it "can create an elasticsearch client" do
      ::Elasticsearch::Client.should_receive(:new).with(host: 'localhost:9200', log: false)
      ContentItem.es_client
    end

    it "should create item with content from hash" do
      c = ContentItem.new(foo: 'foo', bar: 'bar')

      expect(c.foo).to eq('foo')
      expect(c.bar).to eq('bar')
    end

    it "should create item with content from array" do
      c = ContentItem.new(['foo', 'bar'])

      expect(c[0]).to eq('foo')
      expect(c[1]).to eq('bar')<commit_msg>Move elasticsearch config test.<commit_after>require 'spec_helper'

describe ContentItem do
  before :each do
    ContentItem.stub(:setup_search!)
  end

  describe "config" do
    it "should create an elasticsearch client" do
      ::Elasticsearch::Client.should_receive(:new).with(host: 'localhost:9200', log: false)
      ContentItem.es_client
    end
  end

  describe "creating" do
    it "should create item with content from hash" do
      c = ContentItem.new(foo: 'foo', bar: 'bar')

      expect(c.foo).to eq('foo')
      expect(c.bar).to eq('bar')
    end

    it "should create item with content from array" do
      c = ContentItem.new(['foo', 'bar'])

      expect(c[0]).to eq('foo')
      expect(c[1]).to eq('bar')
{'fraction_non_alphanumeric': 0.13432835820895522, 'fraction_numerical': 0.008528784648187633, 'mean_word_length': 3.2666666666666666, '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': '7288230', 'n_tokens_mistral': 460, 'n_tokens_neox': 444, 'n_words': 128}