Class: CarrierWave::Test::Matchers::HaveDirectoryPermissions
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::HaveDirectoryPermissions
- Defined in:
- lib/carrierwave/test/matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(expected) ⇒ HaveDirectoryPermissions
constructor
A new instance of HaveDirectoryPermissions.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ HaveDirectoryPermissions
Returns a new instance of HaveDirectoryPermissions.
72 73 74 |
# File 'lib/carrierwave/test/matchers.rb', line 72 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
90 91 92 |
# File 'lib/carrierwave/test/matchers.rb', line 90 def description "have permissions #{@expected.to_s(8)}" end |
#failure_message ⇒ Object
82 83 84 |
# File 'lib/carrierwave/test/matchers.rb', line 82 def "expected #{File.dirname @actual.current_path.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0o777).to_s(8)}" end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
86 87 88 |
# File 'lib/carrierwave/test/matchers.rb', line 86 def "expected #{File.dirname @actual.current_path.inspect} not to have permissions #{@expected.to_s(8)}, but it did" end |
#matches?(actual) ⇒ Boolean
76 77 78 79 80 |
# File 'lib/carrierwave/test/matchers.rb', line 76 def matches?(actual) @actual = actual # Satisfy expectation here. Return false or raise an error if it's not met. (File.stat(File.dirname(@actual.path)).mode & 0o777) == @expected end |