<commit_before># == Schema Information
#
# Table name: entities
#
#  id          :integer         not null, primary key
#  name        :string(255)
#  slug        :string(255)
#  description :text
#  blurb       :text
#  logo        :string(255)
#  type        :string(255)
#  level       :string(255)
#  created_at  :datetime        not null
#  updated_at  :datetime        not null
#  formal_name :string(255)
#  short_name  :string(255)
#  display     :boolean         default(FALSE)
#

require 'spec_helper'

describe Entity do
end<commit_msg>Add tests to completely cover Entity model<commit_after># == Schema Information
#
# Table name: entities
#
#  id          :integer         not null, primary key
#  name        :string(255)
#  slug        :string(255)
#  description :text
#  blurb       :text
#  logo        :string(255)
#  type        :string(255)
#  level       :string(255)
#  created_at  :datetime        not null
#  updated_at  :datetime        not null
#  formal_name :string(255)
#  short_name  :string(255)
#  display     :boolean         default(FALSE)
#

require 'spec_helper'

describe Entity do
  before { @entity = Fabricate.build(:entity) }
  subject { @entity }

  it { should validate_presence_of(:type) }
  it { should ensure_inclusion_of(:type).in_array(["school", "company", "community"]) }
  it { should ensure_inclusion_of(:level).in_array(["cool", "awesome"]) }

  it { should have_many(:event_partners) }
  it { should have_many(:events).through(:event_partners) }

  describe "#inheritance_column" do
    it "must disable STI to use 'type' as a column name" do
      Entity.inheritance_column.should eq("disabled")
    end
  end
end
{'fraction_non_alphanumeric': 0.11264230077890952, 'fraction_numerical': 0.025164769322947873, 'mean_word_length': 2.839080459770115, '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': '1432028', 'n_tokens_mistral': 569, 'n_tokens_neox': 533, 'n_words': 141}