test: ensure stories are hidden in active tab

This commit is contained in:
tassja 2022-11-07 16:26:57 +01:00
parent 6a3041a000
commit 37b2ff6bf0
1 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,19 @@ describe StoryRepository do
expect(repo.active).to eq([newer_comment.story, older_comment.story])
end
it "does not show hidden stories" do
hidden_story = create(:story)
normal_story = create(:story)
create(:comment, story: hidden_story)
normal_comment = create(:comment, story: normal_story)
HiddenStory.hide_story_for_user(hidden_story.id, hidden_story.user_id)
hidden_story_user = User.find_by(:id => hidden_story.user_id)
repo = StoryRepository.new(hidden_story_user)
expect(repo.active).to eq([normal_comment.story])
end
end
describe ".newest_by_user" do