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