<commit_before>require 'rails_helper'

describe LikesController do
  let(:like) { FactoryBot.create :like, member: member }
  let(:member) { FactoryBot.create(:member) }
  let(:blogpost) { FactoryBot.create(:post) }
  let(:mypost) { FactoryBot.create(:post, author: member) }

  before { sign_in member }

  describe "POST create" do
    before { post :create, post_id: blogpost.id, format: :json }
    it { expect(response.content_type).to eq "application/json" }

    it { expect(Like.last.likeable_id).to eq(blogpost.id) }
    it { expect(Like.last.likeable_type).to eq('Post') }
    it { JSON.parse(response.body)["description"] == "1 like" }

    describe "Liking someone else's post" do
      it { expect(response.code).to eq('201') }
    end

    describe "Liking your own post" do
      let(:blogpost) { FactoryBot.create(:post, author: member) }
    end
  end

  describe "DELETE destroy" do
    before { delete :destroy, id: like.id, format: :json }

    it { expect(response.content_type).to eq "application/json" }

    describe "un-liking something i liked before" do
      it { expect(response.code).to eq('200') }
      it { JSON.parse(response.body)["description"] == "0 likes" }
    end
<commit_msg>Auto corrected by following Ruby rspec layout<commit_after>require 'rails_helper'

describe LikesController do
  let(:like) { FactoryBot.create :like, member: member }
  let(:member) { FactoryBot.create(:member) }
  let(:blogpost) { FactoryBot.create(:post) }
  let(:mypost) { FactoryBot.create(:post, author: member) }

  before { sign_in member }

  describe "POST create" do
    before { post :create, post_id: blogpost.id, format: :json }

    it { expect(response.content_type).to eq "application/json" }

    it { expect(Like.last.likeable_id).to eq(blogpost.id) }
    it { expect(Like.last.likeable_type).to eq('Post') }
    it { JSON.parse(response.body)["description"] == "1 like" }

    describe "Liking someone else's post" do
      it { expect(response.code).to eq('201') }
    end

    describe "Liking your own post" do
      let(:blogpost) { FactoryBot.create(:post, author: member) }
    end
  end

  describe "DELETE destroy" do
    before { delete :destroy, id: like.id, format: :json }

    it { expect(response.content_type).to eq "application/json" }

    describe "un-liking something i liked before" do
      it { expect(response.code).to eq('200') }
      it { JSON.parse(response.body)["description"] == "0 likes" }
    end

{'fraction_non_alphanumeric': 0.14036511156186612, 'fraction_numerical': 0.006490872210953347, 'mean_word_length': 3.6353383458646618, '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': '6876219', 'n_tokens_mistral': 811, 'n_tokens_neox': 777, 'n_words': 202}