Skip to content
Browse files

Fixed bugs in should_have_attached_file

  • Loading branch information...
1 parent 7c598fb commit 4bc50bda1df51d839e86176e794d4f234342a2f5 @jyurek jyurek committed Oct 14, 2008
Showing with 5 additions and 5 deletions.
  1. +5 −5 shoulda_macros/paperclip.rb
View
10 shoulda_macros/paperclip.rb
@@ -4,16 +4,16 @@ def should_have_attached_file name, options = {}
klass = self.name.gsub(/Test$/, '').constantize
context "Class #{klass.name} with attachment #{name}" do
should "respond to all the right methods" do
- ["#{name}_file_name", name, "#{name}?"].each do |meth|
- assert_responds_to object, meth, "#{klass.name} does not respond to #{name}."
+ [name, "#{name}=", "#{name}?"].each do |meth|
+ assert klass.instance_methods.include?(meth), "#{klass.name} does not respond to #{name}."
end
end
should "have the correct definition" do
expected = options
- actual = klass.attachment_definition[name]
- expected.delete(:validations) unless options.key?(:validations)
- expected.delete(:whiny_thumbnails) unless options.key?(:whiny_thumbnails)
+ actual = klass.attachment_definitions[name]
+ expected.delete(:validations) if not options.key?(:validations)
+ expected.delete(:whiny_thumbnails) if not options.key?(:whiny_thumbnails)
assert_equal expected, actual
end

0 comments on commit 4bc50bd

Please sign in to comment.
Something went wrong with that request. Please try again.