Class: RiotCarrierwave::HasPermissionAssertion

Inherits:
Riot::AssertionMacro
  • Object
show all
Defined in:
lib/riot-carrierwave/has_permission.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(model, permission) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/riot-carrierwave/has_permission.rb', line 5

def evaluate(model, permission)
  if model and ((File.stat(model.path).mode & 0777) == permission)
    pass("#{model.class.name} has permission of #{permission.to_s(8)}")
  else
    fail("expected #{model.class.name} to have permission of #{permission.to_s(8)}")
  end
end