# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 16 def initialize attachment_name @attachment_name = attachment_name end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 34 def description "have an attachment named #{@attachment_name}" end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 26 def failure_message "Should have an attachment named #{@attachment_name}" end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 20 def matches? subject @subject = subject @subject = @subject.class unless Class === @subject responds? && has_column? && included? end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 30 def negative_failure_message "Should not have an attachment named #{@attachment_name}" end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 47 def has_column? @subject.column_names.include?("#{@attachment_name}_file_name") end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 51 def included? @subject.ancestors.include?(Paperclip::InstanceMethods) end
# File lib/paperclip/matchers/have_attached_file_matcher.rb, line 40 def responds? methods = @subject.instance_methods.map(&:to_s) methods.include?("#{@attachment_name}") && methods.include?("#{@attachment_name}=") && methods.include?("#{@attachment_name}?") end