From 66c047151572d126b815622a6f935f4c745b625e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 25 Oct 2024 04:35:07 -0400 Subject: [PATCH] Enrich coverage for `IpBlock` model (#32471) --- app/models/ip_block.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/ip_block.rb b/app/models/ip_block.rb index d6242efbf7..5ed4d2a846 100644 --- a/app/models/ip_block.rb +++ b/app/models/ip_block.rb @@ -36,9 +36,14 @@ class IpBlock < ApplicationRecord class << self def blocked?(remote_ip) - blocked_ips_map = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(IpBlock.where(severity: :no_access).pluck(:ip)) } blocked_ips_map.include?(remote_ip) end + + private + + def blocked_ips_map + Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(severity_no_access.pluck(:ip)) } + end end private