Class: CarrierWave::Test::Matchers::HavePermissions
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::HavePermissions
- Defined in:
- lib/carrierwave/test/matchers.rb
Overview
:nodoc:
Instance Method Summary (collapse)
- - (Object) failure_message
-
- (HavePermissions) initialize(expected)
constructor
A new instance of HavePermissions.
- - (Boolean) matches?(actual)
- - (Object) negative_failure_message
Constructor Details
- (HavePermissions) initialize(expected)
A new instance of HavePermissions
33 34 35 |
# File 'lib/carrierwave/test/matchers.rb', line 33 def initialize(expected) @expected = expected end |
Instance Method Details
- (Object) failure_message
43 44 45 |
# File 'lib/carrierwave/test/matchers.rb', line 43 def "expected #{@actual.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0777).to_s(8)}" end |
- (Boolean) matches?(actual)
37 38 39 40 41 |
# File 'lib/carrierwave/test/matchers.rb', line 37 def matches?(actual) @actual = actual # Satisfy expectation here. Return false or raise an error if it's not met. (File.stat(@actual.path).mode & 0777) == @expected end |
- (Object) negative_failure_message
47 48 49 |
# File 'lib/carrierwave/test/matchers.rb', line 47 def "expected #{@actual.inspect} not to have permissions #{@expected.to_s(8)}, but it did" end |