<commit_before>require 'spec_helper'

describe ActsAsLikeable::Likeable do

	let(:liker) { Liker.create(name: "Charlie") }
	let(:likeable) { Likeable.create(name: "cheese") }

	it "should be likeable" do
		expect(Likeable).to be_likeable
	end

	describe "Association" do
		it "should have many likes" do
			association = Likeable.reflect_on_association(:likes)
			expect(association.macro).to eq :has_many
		end

		it "should have many likes with dependent destroy" do
			association = Likeable.reflect_on_association(:likes)
			expect(association.options).to include :dependent => :destroy
		end
	end

	describe "#like_count" do
		it "should count likes" do
			create_like(liker, likeable)
			expect(likeable.like_count).to eq 1
		end
	end

	describe "#liked_by?" do
		context "when liker likes likeable" do
			it "should return true" do
				create_like(liker, likeable)
				expect(likeable.liked_by?(liker)).to be true
			end
		end

		context "when liker hasn't liked likeable" do
			it "should return false" do
				expect(likeable.liked_by?(liker)).to be false
			end
		end
	end
end<commit_msg>Clarify the wording in test<commit_after>require 'spec_helper'

describe ActsAsLikeable::Likeable do

	let(:liker) { Liker.create(name: "Charlie") }
	let(:likeable) { Likeable.create(name: "cheese") }

	it "should be likeable" do
		expect(Likeable).to be_likeable
	end

	describe "Association" do
		it "should have many likes" do
			association = Likeable.reflect_on_association(:likes)
			expect(association.macro).to eq :has_many
		end

		it "should have many likes with dependent destroy" do
			association = Likeable.reflect_on_association(:likes)
			expect(association.options).to include :dependent => :destroy
		end
	end

	describe "#like_count" do
		it "should count likes" do
			create_like(liker, likeable)
			expect(likeable.like_count).to eq 1
		end
	end

	describe "#liked_by?" do
		context "when liker has liked likeable" do
			it "should return true" do
				create_like(liker, likeable)
				expect(likeable.liked_by?(liker)).to be true
			end
		end

		context "when liker hasn't liked likeable" do
			it "should return false" do
				expect(likeable.liked_by?(liker)).to be false
			end
		end
	end
end
{'fraction_non_alphanumeric': 0.0949367088607595, 'fraction_numerical': 0.0009041591320072332, 'mean_word_length': 4.21933962264151, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1641107', 'n_tokens_mistral': 853, 'n_tokens_neox': 733, 'n_words': 216}