# Check that the block edit page requires us to login
get :edit, :params => { :id => active_block.id }
# Check that the block edit page requires us to login
get :edit, :params => { :id => active_block.id }
:user_block_period => "12",
:user_block => { :needs_view => true, :reason => "Vandalism" } }
end
:user_block_period => "12",
:user_block => { :needs_view => true, :reason => "Vandalism" } }
end
assert_equal "Only the moderator who created this block can edit it.", flash[:error]
# Login as the correct moderator
assert_equal "Only the moderator who created this block can edit it.", flash[:error]
# Login as the correct moderator
:params => { :id => active_block.id,
:user_block_period => "99" }
end
:params => { :id => active_block.id,
:user_block_period => "99" }
end
assert_equal "The blocking period must be one of the values selectable in the drop-down list.", flash[:error]
# Check that updating a block works
assert_equal "The blocking period must be one of the values selectable in the drop-down list.", flash[:error]
# Check that updating a block works
:user_block_period => "12",
:user_block => { :needs_view => true, :reason => "Vandalism" } }
end
:user_block_period => "12",
:user_block => { :needs_view => true, :reason => "Vandalism" } }
end
assert_equal "Block updated.", flash[:notice]
b = UserBlock.find(active_block.id)
assert_in_delta Time.now, b.updated_at, 1
assert_equal "Block updated.", flash[:notice]
b = UserBlock.find(active_block.id)
assert_in_delta Time.now, b.updated_at, 1
# Check that revoking a block works
post :revoke, :params => { :id => active_block.id, :confirm => true }
# Check that revoking a block works
post :revoke, :params => { :id => active_block.id, :confirm => true }
b = UserBlock.find(active_block.id)
assert_in_delta Time.now, b.ends_at, 1
b = UserBlock.find(active_block.id)
assert_in_delta Time.now, b.ends_at, 1