Implement EmailBlackList (#5109)
* Implement BlacklistedEmailDomain * Use Faker::Internet.domain_name * Remove note column * Add frozen_string_literal comment * Delete unnecessary codes * Sort alphabetically * Change of wording * Rename BlacklistedEmailDomain to EmailDomainBlock
This commit is contained in:
parent
d5091387c6
commit
b3af3f9f8c
15 changed files with 207 additions and 1 deletions
21
spec/models/email_domain_block_spec.rb
Normal file
21
spec/models/email_domain_block_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
it 'returns true if the domain is not registed' do
|
||||
Fabricate(:email_domain_block, domain: 'domain')
|
||||
expect(EmailDomainBlock.block?('example')).to eq false
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue