Commit 53f9558a by jyurek

Tweaks

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@299 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent 9412f71b
...@@ -34,11 +34,10 @@ module Paperclip ...@@ -34,11 +34,10 @@ module Paperclip
self.original_file_size = uploaded_file.size self.original_file_size = uploaded_file.size
self[:original] = uploaded_file.read self[:original] = uploaded_file.read
@dirty = true @dirty = true
@delete_on_save = false
if definition.content_type == :image
convert( self[:original] ) convert( self[:original] )
end end
end
def [](style) #:nodoc: def [](style) #:nodoc:
@files[style] @files[style]
......
...@@ -5,9 +5,12 @@ class TestPaperclip < Test::Unit::TestCase ...@@ -5,9 +5,12 @@ class TestPaperclip < Test::Unit::TestCase
context "Paperclip" do context "Paperclip" do
should "allow overriding options" do should "allow overriding options" do
not_expected = Paperclip.options[:image_magick_path] [:image_magick_path, :whiny_deletes, :whiny_thumbnails].each do |option|
Paperclip.options[:image_magick_path] = "123" not_expected = Paperclip.options[option]
assert_equal "123", Paperclip.options[:image_magick_path] Paperclip.options[option] = "123"
assert_equal "123", Paperclip.options[option]
assert_not_equal not_expected, Paperclip.options[option]
end
end end
should "give the correct path for a command" do should "give the correct path for a command" do
...@@ -20,9 +23,10 @@ class TestPaperclip < Test::Unit::TestCase ...@@ -20,9 +23,10 @@ class TestPaperclip < Test::Unit::TestCase
assert_equal expected, Paperclip.path_for_command("wtf") assert_equal expected, Paperclip.path_for_command("wtf")
end end
context "being used on class Improper" do context "being used on improper class Improper" do
setup do setup do
ActiveRecord::Base.connection.create_table :impropers, :force => true do |table| ActiveRecord::Base.connection.create_table :impropers, :force => true do |table|
# Empty table
end end
Object.send(:remove_const, :Improper) rescue nil Object.send(:remove_const, :Improper) rescue nil
class ::Improper < ActiveRecord::Base; end class ::Improper < ActiveRecord::Base; end
......
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