Add coverage for `DomainBlock#public_domain` method (#25283)

pull/2246/head
Matt Jankowski 2023-06-06 07:34:04 -04:00 committed by GitHub
parent fb5bf5cbf8
commit b22bfae4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -91,4 +91,22 @@ RSpec.describe DomainBlock do
expect(newer.stricter_than?(older)).to be false
end
end
describe '#public_domain' do
context 'with a domain block that is obfuscated' do
let(:domain_block) { Fabricate(:domain_block, domain: 'hostname.example.com', obfuscate: true) }
it 'garbles the domain' do
expect(domain_block.public_domain).to eq 'hostna**.******e.com'
end
end
context 'with a domain block that is not obfuscated' do
let(:domain_block) { Fabricate(:domain_block, domain: 'example.com', obfuscate: false) }
it 'returns the domain value' do
expect(domain_block.public_domain).to eq 'example.com'
end
end
end
end