Class: Paperclip::Shoulda::Matchers::ValidateAttachmentPresenceMatcher
- Inherits:
-
Object
- Object
- Paperclip::Shoulda::Matchers::ValidateAttachmentPresenceMatcher
- Defined in:
- lib/paperclip/matchers/validate_attachment_presence_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(attachment_name) ⇒ ValidateAttachmentPresenceMatcher
constructor
A new instance of ValidateAttachmentPresenceMatcher.
- #matches?(subject) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(attachment_name) ⇒ ValidateAttachmentPresenceMatcher
Returns a new instance of ValidateAttachmentPresenceMatcher.
9 10 11 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 9 def initialize @attachment_name = end |
Instance Method Details
#description ⇒ Object
26 27 28 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 26 def description "require presence of attachment #{@attachment_name}" end |
#failure_message ⇒ Object
18 19 20 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 18 def "Attachment #{@attachment_name} should be required" end |
#matches?(subject) ⇒ Boolean
13 14 15 16 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 13 def matches? subject @subject = subject error_when_not_valid? && no_error_when_valid? end |
#negative_failure_message ⇒ Object
22 23 24 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 22 def "Attachment #{@attachment_name} should not be required" end |