Commit ae9d7e91 by Jake Paul Committed by Jon Yurek

Fix for broken validate_attachment_content_type matcher (github issue 211)

parent 44b02fac
......@@ -57,7 +57,8 @@ module Paperclip
file = StringIO.new(".")
file.content_type = type
(subject = @subject.new).attachment_for(@attachment_name).assign(file)
subject.valid? && subject.errors[:"#{@attachment_name}_content_type"].blank?
subject.valid?
subject.errors[:"#{@attachment_name}_content_type"].blank?
end
end
......
......@@ -4,6 +4,7 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
context "validate_attachment_content_type" do
setup do
reset_table("dummies") do |d|
d.string :title
d.string :avatar_file_name
d.string :avatar_content_type
end
......@@ -33,5 +34,14 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
should_accept_dummy_class
end
context "given a class with other validations but matching types" do
setup do
@dummy_class.validates_presence_of :title
@dummy_class.validates_attachment_content_type :avatar, :content_type => %r{image/.*}
end
should_accept_dummy_class
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment