<commit_before>require 'rails_helper'

describe "Posts API" do
  it 'sends a list of posts' do
    FactoryGirl.create_list(:post, 3)

    get '/posts'

    # test for the 200 status-code
    expect(response).to be_success

    # check to make sure the right amount of messages are returned
    expect(json.length).to eq(3)
  end
end<commit_msg>added test for specific post get<commit_after>require 'rails_helper'

describe "Posts API" do
  it 'sends a list of posts' do
    FactoryGirl.create_list(:post, 3)

    get '/posts'

    # test for the 200 status-code
    expect(response).to be_success

    # check to make sure the right amount of messages are returned
    expect(json.length).to eq(3)
  end

  it 'retrieves a specific post' do
    post = FactoryGirl.create(:post)
    get "/posts/#{post.id}"

    expect(response).to be_success

    # check that the post attributes are the same.
    expect(json['title']).to eq(post.title)
    expect(json['content']).to eq(post.content)
    expect(json['author']['username']).to eq(post.author.username)
    expect(json['category']['name']).to eq(post.category.name)
  end

end
{'fraction_non_alphanumeric': 0.11367673179396093, 'fraction_numerical': 0.008880994671403197, 'mean_word_length': 3.5261044176706826, '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': '4313412', 'n_tokens_mistral': 374, 'n_tokens_neox': 347, 'n_words': 111}