<commit_before>require 'spec_helper'

describe FillStatus do
  before do
    FillStatus.new campaign_tag: "test"
  end

  it "should create a new campaign tag when initialized with new name " do
    expect(CampaignTag.last).not_to be_nil
  end

  it "should not create a new campaign tag when initialized with an existing name" do
    FillStatus.new campaign_tag: "test"
    expect(CampaignTag.count).to eq(1)
  end
end<commit_msg>Adding test for deserializing extra<commit_after>require 'spec_helper'

describe FillStatus do
  before do
    FillStatus.new campaign_tag: "test"
  end

  it "should create a new campaign tag when initialized with new name " do
    expect(CampaignTag.last).not_to be_nil
  end

  it "should not create a new campaign tag when initialized with an existing name" do
    FillStatus.new campaign_tag: "test"
    expect(CampaignTag.count).to eq(1)
  end

  it "should deserialize the `extra` field successfully using YAML" do
    fs = create :fill_status, extra: {'some_info' => true}
    expect { YAML.load(fs.extra) }.not_to raise_error
  end
end
{'fraction_non_alphanumeric': 0.06976744186046512, 'fraction_numerical': 0.0018604651162790699, 'mean_word_length': 3.9585253456221197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6792158', 'n_tokens_mistral': 335, 'n_tokens_neox': 324, 'n_words': 122}