paperclip

https://github.com/thoughtbot/paperclip

Ruby

Easy file attachment management for ActiveRecord

Paperclip::Shoulda::Matchers#validate_attachment_size

Ensures that the given instance or class validates the size of the
given attachment as specified.

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

Source | Google | Stack overflow

Edit

git clone [email protected]:thoughtbot/paperclip.git

cd paperclip

open lib/paperclip/matchers/validate_attachment_size_matcher.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Paperclip--Shoulda--Matchers-validate_attachment_size-for-pr


# Commit to git

git add lib/paperclip/matchers/validate_attachment_size_matcher.rbgit commit -m "better docs for Paperclip::Shoulda::Matchers#validate_attachment_size"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Paperclip--Shoulda--Matchers-validate_attachment_size-for-pr

hub pull-request


# Celebrate!