Project

General

Profile

« Previous | Next » 

Revision c88a5e53

Added by Michael Moll about 10 years ago

fixes #4664 - shorten OS description for SUSE

View differences:

app/models/operatingsystems/suse.rb
"SUSE"
end
def self.shorten_description description
return "" if description.blank?
s=description
s.gsub!('SUSE Linux Enterprise Server','SLES')
s.gsub!(/\(.+?\)/,'')
s.squeeze! " "
s.strip!
s.blank? ? description : s
end
def self.model_name
superclass.model_name
end
test/unit/operatingsystem_test.rb
assert_equal 'Ubuntu 12.04.3 LTS', Debian.shorten_description("Ubuntu 12.04.3 LTS")
end
test "SLES LSB description should be correctly shortened" do
assert_equal 'SLES 11', Suse.shorten_description("SUSE Linux Enterprise Server 11 (x86_64)")
end
test "openSUSE LSB description should be correctly shortened" do
assert_equal 'openSUSE 11.4', Suse.shorten_description("openSUSE 11.4 (x86_64)")
end
test "OSes without a shorten_description method fall back to description" do
assert_equal 'Arch Linux', Archlinux.shorten_description("Arch Linux")
end

Also available in: Unified diff