Sha256: 0c6385f6ed99dd91d0d65e1258d0a21aaaa60d3519ea7cbe4b1fce79e8fb8d02

Contents?: true

Size: 1.1 KB

Versions: 62

Compression:

Stored size: 1.1 KB

Contents

require 'paperclip/matchers/have_attached_file_matcher'
require 'paperclip/matchers/validate_attachment_presence_matcher'
require 'paperclip/matchers/validate_attachment_content_type_matcher'
require 'paperclip/matchers/validate_attachment_size_matcher'

module Paperclip
  module Shoulda
    # Provides rspec-compatible matchers for testing Paperclip attachments.
    #
    # In spec_helper.rb, you'll need to require the matchers:
    #
    #   require "paperclip/matchers"
    #
    # And include the module:
    #
    #   Spec::Runner.configure do |config|
    #     config.include Paperclip::Shoulda::Matchers
    #   end
    #
    # Example:
    #   describe User do
    #     it { should have_attached_file(:avatar) }
    #     it { should validate_attachment_presence(:avatar) }
    #     it { should validate_attachment_content_type(:avatar).
    #                   allowing('image/png', 'image/gif').
    #                   rejecting('text/plain', 'text/xml') }
    #     it { should validate_attachment_size(:avatar).
    #                   less_than(2.megabytes) }
    #   end
    module Matchers
    end
  end
end

Version data entries

62 entries across 62 versions & 22 rubygems

Version Path
paperclip-hacked-2.3.1.2 lib/paperclip/matchers.rb
paperclip-hacked-2.3.1.1 lib/paperclip/matchers.rb