Project

General

Profile

« Previous | Next » 

Revision a525db23

Added by Stephen Benjamin almost 6 years ago

fixes #23232 - fix error when domain not in taxonomy

This ensures that if domain_id is set, but domain not found (for example
when domain is in another taxonomy), the shortname still removes the
domain from the host's FQDN.

View differences:

test/models/hosts/base_test.rb
assert host.primary_interface
assert_equal 1, host.interfaces.size
end
test 'shortname periods check considers domain outside taxonomy scope' do
host_org = FactoryBot.create(:organization)
other_org = FactoryBot.create(:organization)
domain = FactoryBot.create(:domain, organizations: [other_org])
refute domain.organizations.include?(host_org)
host = FactoryBot.create(:host, organization: host_org, domain_id: domain.id)
host = Host.find(host.id)
assert host.valid?
end
end
end

Also available in: Unified diff