module Paperclip::Shoulda::Matchers

def have_attached_file name

end
it { should have_attached_file(:avatar) }
describe User do
Example:

given name.
Ensures that the given instance or class has an attachment with the
def have_attached_file name
  HaveAttachedFileMatcher.new(name)
end

def validate_attachment_content_type name

end
rejecting('text/plain', 'text/xml') }
allowing('image/png', 'image/gif').
it { should validate_attachment_content_type(:icon).
describe User do
Example:

the given attachment as specified.
Ensures that the given instance or class validates the content type of
def validate_attachment_content_type name
  ValidateAttachmentContentTypeMatcher.new(name)
end

def validate_attachment_presence name

end
it { should validate_attachment_presence(:avatar) }
describe User do

given attachment.
Ensures that the given instance or class validates the presence of the
def validate_attachment_presence name
  ValidateAttachmentPresenceMatcher.new(name)
end

def validate_attachment_size name

in(0..100) }
it { should validate_attachment_size(:icon).
greater_than(1024) }
it { should validate_attachment_size(:icon).
less_than(2.megabytes) }
it { should validate_attachment_size(:avatar).
Examples:

given attachment as specified.
Ensures that the given instance or class validates the size of the
def validate_attachment_size name
  ValidateAttachmentSizeMatcher.new(name)
end