Skip to content

Commit

Permalink
Fix executable? and executable_real? file permissions predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrykonchin authored and eregon committed Jul 27, 2022
1 parent 78b5d86 commit 290e36a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/mspec/guards/superuser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ def match?
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

0 comments on commit 290e36a

Please sign in to comment.