logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

email_domain_block_spec.rb (677B)


  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