Create an empty revoke all blocks page
This commit is contained in:
parent
8682b58154
commit
ba53dc7b04
3 changed files with 36 additions and 0 deletions
|
@ -89,6 +89,12 @@ class UserBlocksController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# revokes all active blocks
|
||||||
|
def revoke_all
|
||||||
|
# TODO revoke
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# shows a list of all the blocks on the given user
|
# shows a list of all the blocks on the given user
|
||||||
def blocks_on
|
def blocks_on
|
||||||
|
|
0
app/views/user_blocks/revoke_all.html.erb
Normal file
0
app/views/user_blocks/revoke_all.html.erb
Normal file
|
@ -394,6 +394,36 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_select "p", "Sorry, the user block with ID 99999 could not be found."
|
assert_select "p", "Sorry, the user block with ID 99999 could not be found."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# test the revoke all action
|
||||||
|
def test_revoke_all
|
||||||
|
blocked_user = create(:user)
|
||||||
|
create(:user_block, :user => blocked_user)
|
||||||
|
|
||||||
|
# Asking for the revoke all blocks page with a bogus user name should fail
|
||||||
|
get user_blocks_on_path(:display_name => "non_existent_user")
|
||||||
|
assert_response :not_found
|
||||||
|
|
||||||
|
# Check that the revoke all blocks page requires us to login
|
||||||
|
get revoke_all_user_blocks_path(blocked_user)
|
||||||
|
assert_redirected_to login_path(:referer => revoke_all_user_blocks_path(blocked_user))
|
||||||
|
|
||||||
|
# Login as a normal user
|
||||||
|
session_for(create(:user))
|
||||||
|
|
||||||
|
# Check that normal users can't load the revoke all blocks page
|
||||||
|
get revoke_all_user_blocks_path(blocked_user)
|
||||||
|
assert_response :redirect
|
||||||
|
assert_redirected_to :controller => "errors", :action => "forbidden"
|
||||||
|
|
||||||
|
# Login as a moderator
|
||||||
|
session_for(create(:moderator_user))
|
||||||
|
|
||||||
|
# Check that the revoke all blocks page loads for moderators
|
||||||
|
get revoke_all_user_blocks_path(blocked_user)
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# test the blocks_on action
|
# test the blocks_on action
|
||||||
def test_blocks_on
|
def test_blocks_on
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue