2023-02-22 01:55:31 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-30 11:10:46 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2023-03-04 17:16:45 +01:00
|
|
|
describe DomainAllow do
|
2024-01-18 17:11:04 +01:00
|
|
|
describe 'Validations' do
|
|
|
|
it 'is invalid without a domain' do
|
|
|
|
domain_allow = Fabricate.build(:domain_allow, domain: nil)
|
|
|
|
domain_allow.valid?
|
|
|
|
expect(domain_allow).to model_have_error_on_field(:domain)
|
|
|
|
end
|
2023-03-04 17:16:45 +01:00
|
|
|
|
2024-01-18 17:11:04 +01:00
|
|
|
it 'is invalid if the same normalized domain already exists' do
|
|
|
|
_domain_allow = Fabricate(:domain_allow, domain: 'にゃん')
|
|
|
|
domain_allow_with_normalized_value = Fabricate.build(:domain_allow, domain: 'xn--r9j5b5b')
|
|
|
|
domain_allow_with_normalized_value.valid?
|
|
|
|
expect(domain_allow_with_normalized_value).to model_have_error_on_field(:domain)
|
2023-03-04 17:16:45 +01:00
|
|
|
end
|
|
|
|
end
|
2019-07-30 11:10:46 +02:00
|
|
|
end
|