Class: Serverspec::Type::Service

Inherits:
Base
  • Object
show all
Defined in:
lib/serverspec/type/service.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_s

Constructor Details

This class inherits a constructor from Serverspec::Type::Base

Instance Method Details

#enabled?(level = 3) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/serverspec/type/service.rb', line 4

def enabled?(level=3)
  backend.check_enabled(@name, level)
end

#has_property?(property) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/serverspec/type/service.rb', line 22

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

#running?(under) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/serverspec/type/service.rb', line 8

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