Skip to content

Instantly share code, notes, and snippets.

@dirceu
Created December 23, 2010 12:05
Show Gist options
  • Save dirceu/752884 to your computer and use it in GitHub Desktop.
Save dirceu/752884 to your computer and use it in GitHub Desktop.
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
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