Class | Paperclip::Shoulda::Matchers::HaveAttachedFileMatcher |
In: |
lib/paperclip/matchers/have_attached_file_matcher.rb
|
Parent: | Object |
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 16 16: def initialize attachment_name 17: @attachment_name = attachment_name 18: end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 34 34: def description 35: "have an attachment named #{@attachment_name}" 36: end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 26 26: def failure_message 27: "Should have an attachment named #{@attachment_name}" 28: end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 20 20: def matches? subject 21: @subject = subject 22: @subject = @subject.class unless Class === @subject 23: responds? && has_column? && included? 24: end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 30 30: def negative_failure_message 31: "Should not have an attachment named #{@attachment_name}" 32: end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 47 47: def has_column? 48: @subject.column_names.include?("#{@attachment_name}_file_name") 49: end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 51 51: def included? 52: @subject.ancestors.include?(Paperclip::InstanceMethods) 53: end