<commit_before>module Serverspec::Type
  class Service < Base
    def enabled?(level, under=nil)
      check_method = "check_service_is_enabled" + (under ? "_#{under}" : '')

      if level
        @runner.send(check_method.to_sym, @name, level)
      else
        @runner.send(check_method.to_sym, @name)
      end
    end

    def installed?(name, version)
      @runner.check_service_is_installed(@name)
    end

    def has_start_mode?(mode)
      @runner.check_service_has_start_mode(@name, mode)
    end

    def running?(under)
      if under
        check_method = "check_service_is_running_under_#{under}".to_sym
        @runner.send(check_method, @name)
      else
        @runner.check_service_is_running(@name)
      end<commit_msg>Fix service is_enabled test when using under()<commit_after>module Serverspec::Type
  class Service < Base
    def enabled?(level, under=nil)
      under = under ? "_under_#{under.gsub(/^under_/, '')}" : ''
      check_method = "check_service_is_enabled#{under}"

      if level
        @runner.send(check_method.to_sym, @name, level)
      else
        @runner.send(check_method.to_sym, @name)
      end
    end

    def installed?(name, version)
      @runner.check_service_is_installed(@name)
    end

    def has_start_mode?(mode)
      @runner.check_service_has_start_mode(@name, mode)
    end

    def running?(under)
      if under
        check_method = "check_service_is_running_under_#{under}".to_sym
        @runner.send(check_method, @name)
      else
        @runner.check_service_is_running(@name)
      end
{'fraction_non_alphanumeric': 0.10990415335463259, 'fraction_numerical': 0.0, 'mean_word_length': 3.0153846153846153, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '495964', 'n_tokens_mistral': 509, 'n_tokens_neox': 512, 'n_words': 92}