diff options
author | Benoit Daloze <eregontp@gmail.com> | 2022-07-27 17:18:23 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2022-07-27 17:18:23 +0200 |
commit | 44f42413e6c3c2b487a03b53bf6cacbb83ac285b (patch) | |
tree | 592d7bab147ec80721779776d86759a2c805b55b /spec/mspec | |
parent | 70a9328b791f46a16e0f2d85db28b893a6ceed5b (diff) | |
download | ruby-44f42413e6c3c2b487a03b53bf6cacbb83ac285b.tar.gz |
Update to ruby/mspec@290e36a
Diffstat (limited to 'spec/mspec')
-rw-r--r-- | spec/mspec/lib/mspec/guards/superuser.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/mspec/lib/mspec/guards/superuser.rb b/spec/mspec/lib/mspec/guards/superuser.rb index e92ea7e862..24daf9b26c 100644 --- a/spec/mspec/lib/mspec/guards/superuser.rb +++ b/spec/mspec/lib/mspec/guards/superuser.rb @@ -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 |