Commit 4bc50bda by Jon Yurek

Fixed bugs in should_have_attached_file

parent 7c598fbe
...@@ -4,16 +4,16 @@ module Paperclip ...@@ -4,16 +4,16 @@ module Paperclip
klass = self.name.gsub(/Test$/, '').constantize klass = self.name.gsub(/Test$/, '').constantize
context "Class #{klass.name} with attachment #{name}" do context "Class #{klass.name} with attachment #{name}" do
should "respond to all the right methods" do should "respond to all the right methods" do
["#{name}_file_name", name, "#{name}?"].each do |meth| [name, "#{name}=", "#{name}?"].each do |meth|
assert_responds_to object, meth, "#{klass.name} does not respond to #{name}." assert klass.instance_methods.include?(meth), "#{klass.name} does not respond to #{name}."
end end
end end
should "have the correct definition" do should "have the correct definition" do
expected = options expected = options
actual = klass.attachment_definition[name] actual = klass.attachment_definitions[name]
expected.delete(:validations) unless options.key?(:validations) expected.delete(:validations) if not options.key?(:validations)
expected.delete(:whiny_thumbnails) unless options.key?(:whiny_thumbnails) expected.delete(:whiny_thumbnails) if not options.key?(:whiny_thumbnails)
assert_equal expected, actual assert_equal expected, actual
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