Skip to content

Commit

Permalink
Changed capitalize -> camelcase for storage module names.
Browse files Browse the repository at this point in the history
  • Loading branch information
iHiD committed Jul 21, 2011
1 parent cfe406b commit c8a271e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/paperclip/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def valid_assignment? file #:nodoc:
end

def initialize_storage #:nodoc:
storage_class_name = @storage.to_s.camelize
storage_class_name = @storage.to_s.downcase.camelize
begin
@storage_module = Paperclip::Storage.const_get(storage_class_name)
rescue NameError
Expand Down
15 changes: 14 additions & 1 deletion test/attachment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,19 @@ class Paperclip::Test < Paperclip::Processor; end
rebuild_model :storage => :FileSystem
@dummy = Dummy.new
assert @dummy.avatar.is_a?(Paperclip::Storage::Filesystem)

rebuild_model :storage => :Filesystem
@dummy = Dummy.new
assert @dummy.avatar.is_a?(Paperclip::Storage::Filesystem)
end

should "convert underscored storage name to camelcase" do
rebuild_model :storage => :not_here
@dummy = Dummy.new
exception = assert_raises(Paperclip::StorageMethodNotFound) do |e|
@dummy.avatar
end
assert exception.message.include?("NotHere")
end

should "raise an error if you try to include a storage module that doesn't exist" do
Expand Down Expand Up @@ -1061,4 +1074,4 @@ def do_after_all; end
end
end

end
end

0 comments on commit c8a271e

Please sign in to comment.