<commit_before>require 'spec_helper'

describe 'Thread' do 

  before do
    @thread = Thread.create(title: "test 123")
  end

  it 'can slug the title' do
    expect(@thread.slug).to eq("test-123")
  end

  it 'can find a thread based on the slug' do
    slug = @thread.slug
    expect(Thread.find_by_slug(slug).title).to eq("test 123")
  end

  it 'knows when it was created' do 
    expect(@user.created_at).to be_a(DateTime)
  end

  it 'knows when it was last updated' do 
    expect(@user.updated_at).to be_a(DateTime)
  end

end<commit_msg>added has many users through posts test for Thread<commit_after>require 'spec_helper'

describe 'Thread' do 

  before do
    @thread = Thread.create(title: "test 123")
  end

  it 'can slug the title' do
    expect(@thread.slug).to eq("test-123")
  end

  it 'can find a thread based on the slug' do
    slug = @thread.slug
    expect(Thread.find_by_slug(slug).title).to eq("test 123")
  end

  it 'knows when it was created' do 
    expect(@user.created_at).to be_a(DateTime)
  end

  it 'knows when it was last updated' do 
    expect(@user.updated_at).to be_a(DateTime)
  end

  it 'has many users through posts' do 
    @user1 = User.create(username: "test 123", email: "<EMAIL>", password: "<PASSWORD>", moderator: false, administrator: false)
    @user2 = User.create(username: "igor", email: "<EMAIL>", password: "<PASSWORD>", moderator: false, administrator: false)
    @post1 = Post.create(content: "ipsum lorem", user_id: @user1.id, thread_id: @thread.id)
    @post2 = Post.create(content: "blah blah", user_id: @user2.id, thread_id: @thread.id)
    expect(@thread.posts).to be_a(Array)
    expect(@thread.posts).to include(@post1)
    expect(@thread.posts).to include(@post2)
    expect(@thread.users).to be_a(Array)
    expect(@thread.users).to include(@user1)
    expect(@thread.users).to include(@user2)
  end

end
{'fraction_non_alphanumeric': 0.13326226012793177, 'fraction_numerical': 0.01652452025586354, 'mean_word_length': 3.812820512820513, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4527971', 'n_tokens_mistral': 676, 'n_tokens_neox': 635, 'n_words': 184}