Commit 9e73929c by Jon Yurek

Change the content_type macro itself

parent 28242594
...@@ -37,35 +37,9 @@ module Paperclip ...@@ -37,35 +37,9 @@ module Paperclip
klass = self.name.gsub(/Test$/, '').constantize klass = self.name.gsub(/Test$/, '').constantize
valid = [options[:valid]].flatten valid = [options[:valid]].flatten
invalid = [options[:invalid]].flatten invalid = [options[:invalid]].flatten
context "Class #{klass.name} validating content_types on #{name}" do matcher = validate_attachment_presence(name).allows(valid).rejects(invalid)
valid.each do |type| should matcher.description do
context "being assigned a file with a content_type of #{type}" do assert_accepts(matcher, klass)
setup do
@file = StringIO.new(".")
class << @file; attr_accessor :content_type; end
@file.content_type = type
@attachment = klass.new.send(name)
@attachment.assign(@file)
end
should "not have a :content_type validation error" do
assert ! @attachment.errors[:content_type]
end
end
end
invalid.each do |type|
context "being assigned a file with a content_type of #{type}" do
setup do
@file = StringIO.new(".")
class << @file; attr_accessor :content_type; end
@file.content_type = type
@attachment = klass.new.send(name)
@attachment.assign(@file)
end
should "have a :content_type validation error" do
assert @attachment.errors[:content_type]
end
end
end
end 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