From 87f92c0a1c6965ad4a51b171d32a0b678a547acb Mon Sep 17 00:00:00 2001 From: Fumihisa TONAKA Date: Sun, 22 Mar 2015 23:03:41 +0900 Subject: [PATCH] add property and get_property for 'its(:property)' syntax to test property of Solaris service --- lib/serverspec/type/service.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/serverspec/type/service.rb b/lib/serverspec/type/service.rb index 9dcbf311..bbe457fc 100644 --- a/lib/serverspec/type/service.rb +++ b/lib/serverspec/type/service.rb @@ -33,5 +33,20 @@ def monitored_by?(monitor) def has_property?(property) @runner.check_service_has_property(@name, property) end + + def property + get_property if @property.nil? + @property + end + + private + def get_property + @property = {} + props = @runner.get_service_property(@name).stdout + props.split(/\n/).each do |line| + property, _type, *value = line.split(/\s+/) + @property[property] = value.join(' ') + end + end end end