app controller: standardize access denied error handling.
Refactor to use `render_error_page` to handle User::PrivilegeError exceptions. This way these exceptions are logged to New Relic. Changes: * Anonymous users aren't automatically redirected to the login page. Instead they're taken to the access denied page, which links to the login/signup pages. * JSON/XML error responses return `message` instead of `reason`.
This commit is contained in:
@@ -17,7 +17,8 @@ class PostVotesControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
should "not allow banned users to vote" do
|
||||
@banned = create(:banned_user)
|
||||
@banned = create(:user)
|
||||
@ban = create(:ban, user: @banned)
|
||||
post_auth post_votes_path(post_id: @post.id), @banned, params: {:score => "up", :format => "js"}
|
||||
assert_response 403
|
||||
assert_equal(0, @post.reload.score)
|
||||
|
||||
Reference in New Issue
Block a user