Permalink
Browse files

Changed capitalize -> camelcase for storage module names.

  • Loading branch information...
1 parent cfe406b commit c8a271ebeb6e637fac00bdc89c8deeb8c635d2c6 @iHiD iHiD committed Jul 21, 2011
Showing with 15 additions and 2 deletions.
  1. +1 −1 lib/paperclip/attachment.rb
  2. +14 −1 test/attachment_test.rb
@@ -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
View
@@ -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
@@ -1061,4 +1074,4 @@ def do_after_all; end
end
end
-end
+end

0 comments on commit c8a271e

Please sign in to comment.