mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/mspec@290e36a
This commit is contained in:
parent
70a9328b79
commit
44f42413e6
1 changed files with 10 additions and 0 deletions
|
@ -6,10 +6,20 @@ class SuperUserGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class RealSuperUserGuard < SpecGuard
|
||||
def match?
|
||||
Process.uid == 0
|
||||
end
|
||||
end
|
||||
|
||||
def as_superuser(&block)
|
||||
SuperUserGuard.new.run_if(:as_superuser, &block)
|
||||
end
|
||||
|
||||
def as_real_superuser(&block)
|
||||
RealSuperUserGuard.new.run_if(:as_real_superuser, &block)
|
||||
end
|
||||
|
||||
def as_user(&block)
|
||||
SuperUserGuard.new.run_unless(:as_user, &block)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue