2023-02-22 11:55:31 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-30 19:10:46 +10:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2024-09-04 15:12:25 +10:00
|
|
|
RSpec.describe DomainAllow do
|
2024-01-19 03:11:04 +11:00
|
|
|
describe 'Validations' do
|
2024-09-06 01:36:05 +10:00
|
|
|
it { is_expected.to validate_presence_of(:domain) }
|
2023-03-05 03:16:45 +11:00
|
|
|
|
2024-01-19 03:11:04 +11: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-05 03:16:45 +11:00
|
|
|
end
|
|
|
|
end
|
2019-07-30 19:10:46 +10:00
|
|
|
end
|