<commit_before># == Schema Information
#
# Table name: chairs
#
#  id           :integer          not null, primary key
#  name         :string
#  abbreviation :string
#  description  :string
#  created_at   :datetime         not null
#  updated_at   :datetime         not null
#

require 'rails_helper'

RSpec.describe Chair, type: :model do
  it "has a valid factory" do
    expect(FactoryGirl.create(:chair)).to be_valid
  end

  it "returns all hiwis in an unique array" do
    chair = FactoryGirl.create(:chair)
    project1 = FactoryGirl.create(:project)
    project2 = FactoryGirl.create(:project)
    user1 = FactoryGirl.create(:user, first_name: "A")
    user2 = FactoryGirl.create(:user, first_name: "A")
    user3 = FactoryGirl.create(:user, first_name: "A")

    project1.users << user1
    project1.users << user2
    project2.users << user2
    project2.users << user3
    chair.projects << project1
    chair.projects << project2

    expect(chair.hiwis).to eq [user1, user2, user3]
  end
end<commit_msg>added test for chair wimis method<commit_after># == Schema Information
#
# Table name: chairs
#
#  id           :integer          not null, primary key
#  name         :string
#  abbreviation :string
#  description  :string
#  created_at   :datetime         not null
#  updated_at   :datetime         not null
#

require 'rails_helper'

RSpec.describe Chair, type: :model do
  it "has a valid factory" do
    expect(FactoryGirl.create(:chair)).to be_valid
  end

  it "returns all hiwis in an unique array" do
    chair = FactoryGirl.create(:chair)
    project1 = FactoryGirl.create(:project)
    project2 = FactoryGirl.create(:project)
    user1 = FactoryGirl.create(:user, first_name: "A")
    user2 = FactoryGirl.create(:user, first_name: "A")
    user3 = FactoryGirl.create(:user, first_name: "A")

    project1.users << user1
    project1.users << user2
    project2.users << user2
    project2.users << user3
    chair.projects << project1
    chair.projects << project2

    expect(chair.hiwis).to eq [user1, user2, user3]
  end

  it "returns all wimis in an unique array" do
    chair = FactoryGirl.create(:chair)
    user1 = FactoryGirl.create(:user)
    user2 = FactoryGirl.create(:user)
    user3 = FactoryGirl.create(:user)
    chair_wimi1 = FactoryGirl.create(:chair_wimi, application: 'accepted', user: user1, chair: chair)
    chair_wimi2 = FactoryGirl.create(:chair_wimi, application: 'accepted', user: user2, chair: chair)
    chair_wimi3 = FactoryGirl.create(:chair_wimi, application: 'accepted', user: user3, chair: chair)

    expect(chair.wimis).to eq [user1, user2, user3]
  end
end
{'fraction_non_alphanumeric': 0.109375, 'fraction_numerical': 0.018292682926829267, 'mean_word_length': 3.3245469522240527, 'pattern_counts': {'":': 0, '<': 27, '<?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': '6168994', 'n_tokens_mistral': 865, 'n_tokens_neox': 829, 'n_words': 227}