posts/random: fix pundit exception when no post is found.

This commit is contained in:
evazion
2020-03-31 19:12:57 -05:00
parent 08ce5a71c4
commit 25776a062c
2 changed files with 7 additions and 1 deletions

View File

@@ -205,6 +205,11 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
get random_posts_path, params: { tags: "aaaa" }
assert_redirected_to(post_path(@post, tags: "aaaa"))
end
should "return a 404 when no random posts can be found" do
get random_posts_path, params: { tags: "qoigjegoi" }
assert_response 404
end
end
context "show action" do