This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2017-10-04 06:16:10 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe EmailDomainBlock, type: :model do
|
|
|
|
describe 'validations' do
|
|
|
|
it 'has a valid fabricator' do
|
|
|
|
email_domain_block = Fabricate.build(:email_domain_block)
|
|
|
|
expect(email_domain_block).to be_valid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'block?' do
|
|
|
|
it 'returns true if the domain is registed' do
|
|
|
|
Fabricate(:email_domain_block, domain: 'example.com')
|
|
|
|
expect(EmailDomainBlock.block?('nyarn@example.com')).to eq true
|
|
|
|
end
|
2017-11-14 11:37:17 -08:00
|
|
|
|
2017-10-04 06:16:10 -07:00
|
|
|
it 'returns true if the domain is not registed' do
|
2017-11-14 11:37:17 -08:00
|
|
|
Fabricate(:email_domain_block, domain: 'example.com')
|
|
|
|
expect(EmailDomainBlock.block?('nyarn@example.net')).to eq false
|
2017-10-04 06:16:10 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|