Update hostname_shorten and callers

This commit is contained in:
Jake Spain 2023-02-16 09:57:18 -05:00
parent 35dc7cb26f
commit 0119126cd1
No known key found for this signature in database
GPG key ID: BC1C4DA0A085E113
3 changed files with 394 additions and 34 deletions

View file

@ -16,14 +16,12 @@ describe Vmpooler::API::Helpers do
describe '#hostname_shorten' do
[
['example.com', 'not-example.com', 'example'],
['example.com', 'example.com', 'example'],
['sub.example.com', 'example.com', 'sub'],
['adjective-noun.example.com', 'example.com', 'adjective-noun'],
['abc123.example.com', 'example.com', 'abc123'],
['example.com', nil, 'example']
].each do |hostname, domain, expected|
it { expect(subject.hostname_shorten(hostname, domain)).to eq expected }
['example.com', 'example'],
['sub.example.com', 'sub'],
['adjective-noun.example.com', 'adjective-noun'],
['abc123.example.com', 'abc123']
].each do |hostname, expected|
it { expect(subject.hostname_shorten(hostname)).to eq expected }
end
end