Sha256: 91005a1bbcd2ec04b68374c1db48335c2794047b77e38bfb2dd695f18b757903

Contents?: true

Size: 320 Bytes

Versions: 5

Compression:

Stored size: 320 Bytes

Contents

module Busted
  module CurrentProcess
    extend self

    def privileged?
      if root? || sudoer?
        true
      else
        false
      end
    end

    def root?
      Process.euid == 0
    end

    def sudoer?
      system "sudo echo ok > /dev/null 2>&1"
    rescue Errno::EPERM
      false
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
busted-0.2.3 lib/busted/current_process.rb
busted-0.2.2 lib/busted/current_process.rb
busted-0.2.1 lib/busted/current_process.rb
busted-0.2.0 lib/busted/current_process.rb
busted-0.1.0 lib/busted/current_process.rb