Sha256: 38d8c500ec3ab70c60a36fe29f600c2cbfec1ba616a6405e95cad733bdbf089a

Contents?: true

Size: 938 Bytes

Versions: 9

Compression:

Stored size: 938 Bytes

Contents

module Serverspec
  module Type
    class Service < Base
      def enabled?(level=3)
        backend.check_enabled(@name, level)
      end

      def running?(under)
        if under
          check_method = "check_running_under_#{under}".to_sym

          unless backend.respond_to?(check_method)
            raise ArgumentError.new("`be_running` matcher doesn't support #{under}")
          end

          backend.send(check_method, @name)
        else
          backend.check_running(@name)
        end
      end

      def monitored_by?(monitor)
        check_method = "check_monitored_by_#{monitor}".to_sym
        unless monitor && backend.respond_to?(check_method)
          raise ArgumentError.new("`be_monitored_by` matcher doesn't support #{monitor}") 
        end
        backend.send(check_method, @name)
      end

      def has_property?(property)
        backend.check_svcprops(@name, property)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
serverspec-0.6.25 lib/serverspec/type/service.rb
serverspec-0.6.24 lib/serverspec/type/service.rb
serverspec-0.6.23 lib/serverspec/type/service.rb
serverspec-0.6.22 lib/serverspec/type/service.rb
serverspec-0.6.21 lib/serverspec/type/service.rb
serverspec-0.6.20 lib/serverspec/type/service.rb
serverspec-0.6.19 lib/serverspec/type/service.rb
serverspec-0.6.18 lib/serverspec/type/service.rb
serverspec-0.6.17 lib/serverspec/type/service.rb