domain_allow_spec.rb 698 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe DomainAllow do
  4. describe 'Validations' do
  5. it 'is invalid without a domain' do
  6. domain_allow = Fabricate.build(:domain_allow, domain: nil)
  7. domain_allow.valid?
  8. expect(domain_allow).to model_have_error_on_field(:domain)
  9. end
  10. it 'is invalid if the same normalized domain already exists' do
  11. _domain_allow = Fabricate(:domain_allow, domain: 'にゃん')
  12. domain_allow_with_normalized_value = Fabricate.build(:domain_allow, domain: 'xn--r9j5b5b')
  13. domain_allow_with_normalized_value.valid?
  14. expect(domain_allow_with_normalized_value).to model_have_error_on_field(:domain)
  15. end
  16. end
  17. end