Created
December 23, 2010 12:05
-
-
Save dirceu/752884 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'paperclip/matchers' | |
def cancel_paperclip_post_processing(cls) | |
cls.class_eval do | |
before_post_process :cancel_post_processing | |
def cancel_post_processing | |
false | |
end | |
end | |
end | |
# ... other stuff here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
cancel_paperclip_post_processing YourClass | |
describe YourClass do | |
describe "validations" do | |
it "should require a valid contract file (if supplied)" do | |
YourClass.should have_attached_file(:contract) | |
YourClass.should validate_attachment_content_type(:contract).allowing('application/pdf').rejecting('application/msword', 'application/rtf') | |
YourClass.should validate_attachment_size(:contract).less_than(5.megabytes) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment