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
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ HavePermissions
constructor
A new instance of HavePermissions.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected) ⇒ HavePermissions
Returns a new instance of HavePermissions.
40 41 42 |
# File 'lib/carrierwave/test/matchers.rb', line 40 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
58 59 60 |
# File 'lib/carrierwave/test/matchers.rb', line 58 def description "have permissions #{@expected.to_s(8)}" end |
#failure_message ⇒ Object
50 51 52 |
# File 'lib/carrierwave/test/matchers.rb', line 50 def "expected #{@actual.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0777).to_s(8)}" end |
#matches?(actual) ⇒ Boolean
44 45 46 47 48 |
# File 'lib/carrierwave/test/matchers.rb', line 44 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 |
#negative_failure_message ⇒ Object
54 55 56 |
# File 'lib/carrierwave/test/matchers.rb', line 54 def "expected #{@actual.inspect} not to have permissions #{@expected.to_s(8)}, but it did" end |