Class | Paperclip::Shoulda::Matchers::HaveAttachedFileMatcher
In: | vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb
Parent: | Object

### Methods

description failure_message has_column? included? matches? negative_failure_message new responds?

### Public Class methods

new(attachment_name)

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 9
     9:         def initialize attachment_name
    10:           @attachment_name = attachment_name
    11:         end

### Public Instance methods

description()

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 26
    26:         def description
    27:           "have an attachment named #{@attachment_name}"
    28:         end

failure_message()

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 18
    18:         def failure_message
    19:           "Should have an attachment named #{@attachment_name}"
    20:         end

matches?(subject)

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 13
    13:         def matches? subject
    14:           @subject = subject
    15:           responds? && has_column? && included?
    16:         end

negative_failure_message()

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 22
    22:         def negative_failure_message
    23:           "Should not have an attachment named #{@attachment_name}"
    24:         end

### Protected Instance methods

has_column?()

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 39
    39:         def has_column?
    40:           @subject.column_names.include?("#{@attachment_name}_file_name")
    41:         end

included?()

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 43
    43:         def included?
    44:           @subject.ancestors.include?(Paperclip::InstanceMethods)
    45:         end

responds?()

[Source]

        # File vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb, line 32
    32:         def responds?
    33:           methods = @subject.instance_methods
    34:           methods.include?("#{@attachment_name}") &&
    35:             methods.include?("#{@attachment_name}=") &&
    36:             methods.include?("#{@attachment_name}?")
    37:         end

[Validate]