You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
677 B

  1. require 'rails_helper'
  2. RSpec.describe EmailDomainBlock, type: :model do
  3. describe 'validations' do
  4. it 'has a valid fabricator' do
  5. email_domain_block = Fabricate.build(:email_domain_block)
  6. expect(email_domain_block).to be_valid
  7. end
  8. end
  9. describe 'block?' do
  10. it 'returns true if the domain is registed' do
  11. Fabricate(:email_domain_block, domain: 'example.com')
  12. expect(EmailDomainBlock.block?('nyarn@example.com')).to eq true
  13. end
  14. it 'returns true if the domain is not registed' do
  15. Fabricate(:email_domain_block, domain: 'example.com')
  16. expect(EmailDomainBlock.block?('nyarn@example.net')).to eq false
  17. end
  18. end
  19. end