about summary refs log tree commit diff
path: root/spec/models/domain_block_spec.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-01-08 22:42:05 +0100
committerEugen Rochko <eugen@zeonfederated.com>2020-01-08 22:42:05 +0100
commit51eb1115035499a47bb03670c03afbd03ce7c5ac (patch)
tree06d01371e28750c502cf39dfdc50ce75a5e93941 /spec/models/domain_block_spec.rb
parent345dd93310a6ce830444f6f875204d30c43c5a1e (diff)
Allow blocking TLDs, and fix TLD blocks not being editable (#12805)
Fixes #12795

It was already possible to create domain blocks for TLDs, but those
weren't enforced, nor editable. This commit changes it so that they
are enforced and editable.
Diffstat (limited to 'spec/models/domain_block_spec.rb')
-rw-r--r--spec/models/domain_block_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/domain_block_spec.rb b/spec/models/domain_block_spec.rb
index d98c5e118..28647dc89 100644
--- a/spec/models/domain_block_spec.rb
+++ b/spec/models/domain_block_spec.rb
@@ -52,6 +52,16 @@ RSpec.describe DomainBlock, type: :model do
       block = Fabricate(:domain_block, domain: 'sub.example.com')
       expect(DomainBlock.rule_for('sub.example.com')).to eq block
     end
+
+    it 'returns a rule matching a blocked TLD' do
+      block = Fabricate(:domain_block, domain: 'google')
+      expect(DomainBlock.rule_for('google')).to eq block
+    end
+
+    it 'returns a rule matching a subdomain of a blocked TLD' do
+      block = Fabricate(:domain_block, domain: 'google')
+      expect(DomainBlock.rule_for('maps.google')).to eq block
+    end
   end
 
   describe '#stricter_than?' do