From 491bb462d6986a3ae6de62b8ee08bad6816b985d Mon Sep 17 00:00:00 2001 From: Adam Malcontenti-Wilson Date: Fri, 16 Aug 2019 13:02:11 -0700 Subject: [PATCH] Fix service is_enabled test when using under() --- lib/serverspec/type/service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/serverspec/type/service.rb b/lib/serverspec/type/service.rb index 6c295ce8..3b6fb296 100644 --- a/lib/serverspec/type/service.rb +++ b/lib/serverspec/type/service.rb @@ -1,7 +1,8 @@ module Serverspec::Type class Service < Base def enabled?(level, under=nil) - check_method = "check_service_is_enabled" + (under ? "_#{under}" : '') + under = under ? "_under_#{under.gsub(/^under_/, '')}" : '' + check_method = "check_service_is_enabled#{under}" if level @runner.send(check_method.to_sym, @name, level)