favorites: convert user.hide_favorites? to pundit.

This commit is contained in:
evazion
2020-03-21 22:12:23 -05:00
parent 5bc82bf07b
commit 2445e8b82f
7 changed files with 25 additions and 18 deletions

View File

@@ -36,6 +36,12 @@ class RecommendedPostsControllerTest < ActionDispatch::IntegrationTest
assert_select ".recommended-posts"
assert_select ".recommended-posts #post_#{@post.id}"
end
should "not show recommendations for users with private favorites to other users" do
@other_user = create(:user, enable_private_favorites: true)
get_auth recommended_posts_path(search: { user_id: @other_user.id }), @user
assert_response 403
end
end
end
end