<commit_before>require 'spec_helper'

describe Pool do
  before(:each) do
  end

  it "should require unique name" do
    pool1 = Factory.create(:pool)
    pool2 = Factory.create(:pool)
    pool1.should be_valid
    pool2.should be_valid

    pool2.name = pool1.name
    pool2.should_not be_valid
  end

  it "should not be valid if name is too long" do
    u = FactoryGirl.create(:pool)
    u.name = ('a' * 256)
    u.valid?.should be_false
    u.errors[:name].should_not be_nil
    u.errors[:name].should =~ /^is too long.*/
  end

  it "should not be destroyable when it has running instances" do
    pool = Factory.create(:pool)
    Pool.find(pool.id).should be_destroyable

    instance = Factory.create(:instance, :pool_id => pool.id)<commit_msg>pool spec fix<commit_after>require 'spec_helper'

describe Pool do
  before(:each) do
  end

  it "should require unique name" do
    pool1 = Factory.create(:pool)
    pool2 = Factory.create(:pool)
    pool1.should be_valid
    pool2.should be_valid

    pool2.name = pool1.name
    pool2.should_not be_valid
  end

  it "should not be valid if name is too long" do
    u = FactoryGirl.create(:pool)
    u.name = ('a' * 256)
    u.valid?.should be_false
    u.errors[:name].should_not be_nil
    u.errors[:name][0].should =~ /^is too long.*/
  end

  it "should not be destroyable when it has running instances" do
    pool = Factory.create(:pool)
    Pool.find(pool.id).should be_destroyable

    instance = Factory.create(:instance, :pool_id => pool.id)
{'fraction_non_alphanumeric': 0.11015262110152621, 'fraction_numerical': 0.013934970139349702, 'mean_word_length': 3.1542699724517904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2947773', 'n_tokens_mistral': 519, 'n_tokens_neox': 497, 'n_words': 143}