<commit_before># encoding: utf-8

require 'test_helper'

class HasPropertiesTest < Test::Unit::TestCase
  test "a propertized record has many properties" do
    assert_has_many(Good, :properties)
  end
  
  test "a propertized record must confirm it's property by respond_to" do
    good = Good.create!
    assert_equal true, good.respond_to?(:property_template_1)
  end
  
  test "a propertized record must support property getter/setter" do
    good = Good.create!
    good.property_template_1 = '42'
    assert_equal '42', good.property_template_1
  end

  test "a propertized record must save property value in property table" do
    good = Good.create! :property_template_1 => '42'
    assert_equal '42', Property.find_by_good_id_and_property_template_id(good.id,1).value
  end
  
  test "template may be set to different model" do
    item = Item.create! :template_1 => '42'
    assert_equal '42', Prop.find_by_item_id_and_template_id(item.id,1).value
  end
end<commit_msg>test refactoring<commit_after># encoding: utf-8

require 'test_helper'

class HasPropertiesTest < Test::Unit::TestCase
  test "a propertized record has many properties" do
    assert_has_many(Good, :properties)
  end
  
  test "a propertized record must confirm it's property by respond_to" do
    good = Good.create!
    assert_equal true, good.respond_to?(:property_template_1)
  end
  
  test "a propertized record must support property getter/setter" do
    good = Good.create!
    good.property_template_1 = '42'
    assert_equal '42', good.property_template_1
  end

  test "a propertized record must save property value in property table" do
    good = Good.create! :property_template_1 => '42'
    assert_equal '42', good.properties.find_by_property_template_id(1).value
  end
  
  test "template may be set to different model" do
    item = Item.create! :template_1 => '42'
    assert_equal '42', item.properties.find_by_template_id(1).value
  end
end
{'fraction_non_alphanumeric': 0.08457968024755029, 'fraction_numerical': 0.020629190304280558, 'mean_word_length': 4.21505376344086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7030078', 'n_tokens_mistral': 636, 'n_tokens_neox': 619, 'n_words': 182}