mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-24 14:56:27 +00:00
Simplify model validation specs for DomainAllow
(#32496)
This commit is contained in:
parent
9464281f29
commit
1775e151ec
|
@ -6,11 +6,10 @@ RSpec.describe DomainAllow do
|
||||||
describe 'Validations' do
|
describe 'Validations' do
|
||||||
it { is_expected.to validate_presence_of(:domain) }
|
it { is_expected.to validate_presence_of(:domain) }
|
||||||
|
|
||||||
it 'is invalid if the same normalized domain already exists' do
|
context 'when a normalized domain exists' do
|
||||||
_domain_allow = Fabricate(:domain_allow, domain: 'にゃん')
|
before { Fabricate(:domain_allow, domain: 'にゃん') }
|
||||||
domain_allow_with_normalized_value = Fabricate.build(:domain_allow, domain: 'xn--r9j5b5b')
|
|
||||||
domain_allow_with_normalized_value.valid?
|
it { is_expected.to_not allow_value('xn--r9j5b5b').for(:domain) }
|
||||||
expect(domain_allow_with_normalized_value).to model_have_error_on_field(:domain)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue