Commit c8a271eb by Jeremy Walker

Changed capitalize -> camelcase for storage module names.

parent cfe406bf
...@@ -323,7 +323,7 @@ module Paperclip ...@@ -323,7 +323,7 @@ module Paperclip
end end
def initialize_storage #:nodoc: def initialize_storage #:nodoc:
storage_class_name = @storage.to_s.camelize storage_class_name = @storage.to_s.downcase.camelize
begin begin
@storage_module = Paperclip::Storage.const_get(storage_class_name) @storage_module = Paperclip::Storage.const_get(storage_class_name)
rescue NameError rescue NameError
......
...@@ -496,6 +496,19 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -496,6 +496,19 @@ class AttachmentTest < Test::Unit::TestCase
rebuild_model :storage => :FileSystem rebuild_model :storage => :FileSystem
@dummy = Dummy.new @dummy = Dummy.new
assert @dummy.avatar.is_a?(Paperclip::Storage::Filesystem) 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 end
should "raise an error if you try to include a storage module that doesn't exist" do should "raise an error if you try to include a storage module that doesn't exist" do
...@@ -1061,4 +1074,4 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -1061,4 +1074,4 @@ class AttachmentTest < Test::Unit::TestCase
end end
end end
end end
\ No newline at end of file
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