Module: Busted::CurrentProcess
Instance Method Summary collapse
Instance Method Details
#privileged? ⇒ Boolean
5 6 7 8 9 10 11 |
# File 'lib/busted/current_process.rb', line 5 def privileged? if root? || sudoer? true else false end end |
#root? ⇒ Boolean
13 14 15 |
# File 'lib/busted/current_process.rb', line 13 def root? Process.euid == 0 end |
#sudoer? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/busted/current_process.rb', line 17 def sudoer? system "sudo echo ok > /dev/null 2>&1" rescue Errno::EPERM false end |