Skip to content

Commit

Permalink
Add spec for #liked? in User spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ticky committed Apr 26, 2021
1 parent 6a4b385 commit 47659c8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 47659c8

Please sign in to comment.