Class: ActiveStorageValidations::Matchers::ProcessableFileValidatorMatcher
- Inherits:
-
Object
- Object
- ActiveStorageValidations::Matchers::ProcessableFileValidatorMatcher
- Includes:
- ASVActiveStorageable, ASVAllowBlankable, ASVAttachable, ASVContextable, ASVExceptOnable, ASVMessageable, ASVRspecable, ASVTimeoutable, ASVValidatable
- Defined in:
- lib/active_storage_validations/matchers/processable_file_validator_matcher.rb
Constant Summary
Constants included from ASVTimeoutable
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(attribute_name) ⇒ ProcessableFileValidatorMatcher
constructor
A new instance of ProcessableFileValidatorMatcher.
- #matches?(subject) ⇒ Boolean
Methods included from ASVTimeoutable
#initialize_timeoutable, #timeout
Methods included from ASVRspecable
#failure_message_when_negated, #initialize_rspecable
Methods included from ASVMessageable
#initialize_messageable, #with_message
Methods included from ASVExceptOnable
#except_on, #initialize_except_onable
Methods included from ASVContextable
Methods included from ASVAllowBlankable
#allow_blank, #initialize_allow_blankable
Constructor Details
#initialize(attribute_name) ⇒ ProcessableFileValidatorMatcher
Returns a new instance of ProcessableFileValidatorMatcher.
30 31 32 33 34 35 36 37 38 |
# File 'lib/active_storage_validations/matchers/processable_file_validator_matcher.rb', line 30 def initialize(attribute_name) initialize_allow_blankable initialize_contextable initialize_except_onable initialize_rspecable initialize_timeoutable @attribute_name = attribute_name end |
Instance Method Details
#description ⇒ Object
40 41 42 |
# File 'lib/active_storage_validations/matchers/processable_file_validator_matcher.rb', line 40 def description "validate that :#{@attribute_name} is a processable image" end |
#failure_message ⇒ Object
44 45 46 |
# File 'lib/active_storage_validations/matchers/processable_file_validator_matcher.rb', line 44 def "is expected to validate the processable image of :#{@attribute_name}" end |
#matches?(subject) ⇒ Boolean
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/active_storage_validations/matchers/processable_file_validator_matcher.rb', line 48 def matches?(subject) @subject = subject.is_a?(Class) ? subject.new : subject is_a_valid_active_storage_attribute? && is_context_valid? && is_except_on_valid? && is_timeout_valid? && && is_valid_when_image_processable? && is_invalid_when_file_not_processable? end |