module Serverspec
  module Type
    class Process < Base

      def running?
        pid = backend.run_command(commands.get_process(@name, :format => "pid="))[:stdout]
        not pid.empty?
      end

      def method_missing(meth)
        ret = backend.run_command(commands.get_process(@name, :format => "#{meth.to_s}="))
        val = ret[:stdout].strip
        val = val.to_i if val.match(/^\d+$/)
        val
      end

    end
  end
end

module Serverspec
  module Type
    class Process < Base

      def running?
        pid = backend.run_command(commands.get_process(@name, :format => "pid="))[:stdout]
        not pid.empty?
      end

      def user
        get_column("user")
      end

      def group
        get_column("group")
      end

      def method_missing(meth)
        get_column(meth.to_s)
      end

      def get_column(keyword)
        ret = backend.run_command(commands.get_process(@name, :format => "#{keyword}="))
        val = ret[:stdout].strip
        val = val.to_i if val.match(/^\d+$/)
        val
      end
    end
  end
end

Define user and group methods explicitly in Serverspec::Type::Process
Define user and group methods explicitly in Serverspec::Type::Process

Because user and group methods are defined already in Serverspec::Helper::Type.
So method_missing is not called if these methods are not defined explicitly.
