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)
- - (Object) description
- - (Object) failure_message
-
- (ValidateAttachmentPresenceMatcher) initialize(attachment_name)
constructor
A new instance of ValidateAttachmentPresenceMatcher.
- - (Boolean) matches?(subject)
- - (Object) negative_failure_message
Constructor Details
- (ValidateAttachmentPresenceMatcher) initialize(attachment_name)
A new instance of ValidateAttachmentPresenceMatcher
15 16 17 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 15 def initialize @attachment_name = end |
Instance Method Details
- (Object) description
33 34 35 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 33 def description "require presence of attachment #{@attachment_name}" end |
- (Object) failure_message
25 26 27 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 25 def "Attachment #{@attachment_name} should be required" end |
- (Boolean) matches?(subject)
19 20 21 22 23 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 19 def matches? subject @subject = subject @subject = subject.new if subject.class == Class error_when_not_valid? && no_error_when_valid? end |
- (Object) negative_failure_message
29 30 31 |
# File 'lib/paperclip/matchers/validate_attachment_presence_matcher.rb', line 29 def "Attachment #{@attachment_name} should not be required" end |