Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Test for .attachment_definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Jul 29, 2013
1 parent ceb43f1 commit dbb7e04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/paperclip/has_attached_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def add_paperclip_callbacks

module ClassMethods
def attachment_definitions
Paperclip::AttachmentRegistry.definitions_for(self.class)
Paperclip::AttachmentRegistry.definitions_for(self)
end
end
end
Expand Down
12 changes: 12 additions & 0 deletions test/attachment_definitions_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require './test/helper'

class AttachmentDefinitionsTest < Test::Unit::TestCase
should 'return all of the attachments on the class' do
reset_class "Dummy"
Dummy.has_attached_file :avatar, {:path => "abc"}
Dummy.has_attached_file :other_attachment, {:url => "123"}
expected = {:avatar => {:path => "abc"}, :other_attachment => {:url => "123"}}

assert_equal expected, Dummy.attachment_definitions
end
end

0 comments on commit dbb7e04

Please sign in to comment.