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

class VirtualCommunityTest < Test::Unit::TestCase
  fixtures :virtual_communities

  def test_exists_default_and_it_is_unique
    VirtualCommunity.delete_all
    vc = VirtualCommunity.new(:name => 'Test Community')
    vc.is_default = true
    assert vc.save

    vc2 = VirtualCommunity.new(:name => 'Another Test Community')
    vc2.is_default = true
    assert !vc2.valid?
    assert vc2.errors.invalid?(:is_default)

    assert_equal vc, VirtualCommunity.default
  end

  def test_acts_as_configurable
    vc = VirtualCommunity.new(:name => 'Testing VirtualCommunity')
    assert_kind_of Array, vc.settings
    vc.settings[:some_setting] = 1
    assert vc.save
    assert_equal 1, vc.settings[:some_setting]
    assert_kind_of ConfigurableSetting, vc.settings.first<commit_msg>ActionItem9: refactoring to remove acts_as_configurable: a little imature and no feedback from upstream about patches sent<commit_after>require File.dirname(__FILE__) + '/../test_helper'

class VirtualCommunityTest < Test::Unit::TestCase
  fixtures :virtual_communities

  def test_exists_default_and_it_is_unique
    VirtualCommunity.delete_all
    vc = VirtualCommunity.new(:name => 'Test Community')
    vc.is_default = true
    assert vc.save

    vc2 = VirtualCommunity.new(:name => 'Another Test Community')
    vc2.is_default = true
    assert !vc2.valid?
    assert vc2.errors.invalid?(:is_default)

    assert_equal vc, VirtualCommunity.default
  end

  def test_acts_as_configurable
    vc = VirtualCommunity.new(:name => 'Testing VirtualCommunity')
    assert_kind_of Hash, vc.settings
    vc.settings[:some_setting] = 1
    assert vc.save
    assert_equal 1, vc.settings[:some_setting]
{'fraction_non_alphanumeric': 0.09002293577981652, 'fraction_numerical': 0.007454128440366973, 'mean_word_length': 4.402476780185759, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3729062', 'n_tokens_mistral': 566, 'n_tokens_neox': 524, 'n_words': 117}