From 47659c852309dcb811e60a0d397c00c19d946ddf Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Fri, 23 Apr 2021 13:51:56 -0700 Subject: [PATCH] Add spec for #liked? in User spec --- spec/models/user_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1a96592..cc4f41d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -59,4 +59,21 @@ expect(subject).not_to include("eight") end end + + describe "#liked?" do + before do + alice.liked_chirps << bob.chirps.first + alice.liked_chirps << carol.chirps.first + end + + it "returns true for chirps they like" do + expect(alice.liked? bob.chirps.first).to eql(true) + expect(alice.liked? carol.chirps.first).to eql(true) + end + + it "returns false for chirps they don't" do + expect(alice.liked? eve.chirps.first).to eql(false) + expect(alice.liked? alice.chirps.first).to eql(false) + end + end end