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
smarter_paperclip-0.3.3 lib/paperclip/matchers.rb
smarter_paperclip-0.3.2 lib/paperclip/matchers.rb
smarter_paperclip-0.3.1 lib/paperclip/matchers.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/paperclip-2.3.16/lib/paperclip/matchers.rb
smarter_paperclip-0.3.0 lib/paperclip/matchers.rb
mender_paperclip-2.4.3.1 lib/paperclip/matchers.rb
cemeng-paperclip-2.3.6 lib/paperclip/matchers.rb
jmcnevin-paperclip-2.4.5.1 lib/paperclip/matchers.rb
jmcnevin-paperclip-2.4.5 lib/paperclip/matchers.rb
paperclip-2.4.5 lib/paperclip/matchers.rb
mender_paperclip-2.4.3 lib/paperclip/matchers.rb
paperclip-2.4.4 lib/paperclip/matchers.rb
paperclip-2.4.3 lib/paperclip/matchers.rb
paperclip-2.4.2 lib/paperclip/matchers.rb
paperclip-2.4.1 lib/paperclip/matchers.rb
paperclip-2.4.0 lib/paperclip/matchers.rb
paperclip-2.3.16 lib/paperclip/matchers.rb
paperclip-2.3.15 lib/paperclip/matchers.rb
olek-paperclip-2.3.3.2 lib/paperclip/matchers.rb
paperclip-2.3.12 lib/paperclip/matchers.rb