Commit 849b6b8c by jyurek

cleaned up some options malarky

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@249 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent d76ef9be
...@@ -32,7 +32,7 @@ module Paperclip ...@@ -32,7 +32,7 @@ module Paperclip
def file_name style = nil def file_name style = nil
style ||= definition.default_style style ||= definition.default_style
interpolate( style, definition.file_path ) interpolate( style, definition.path )
end end
def ensure_directories def ensure_directories
......
...@@ -34,7 +34,6 @@ module Paperclip ...@@ -34,7 +34,6 @@ module Paperclip
http_host = definition.s3_host || "http://s3.amazonaws.com" http_host = definition.s3_host || "http://s3.amazonaws.com"
"#{http_host}/#{bucket}/#{url_without_s3(style)}" "#{http_host}/#{bucket}/#{url_without_s3(style)}"
end end
alias_method_chain :url, :s3
def file_name style = nil def file_name style = nil
style ||= definition.default_style style ||= definition.default_style
......
...@@ -4,15 +4,15 @@ require File.dirname(__FILE__) + "/test_helper.rb" ...@@ -4,15 +4,15 @@ require File.dirname(__FILE__) + "/test_helper.rb"
class TestAttachmentDefinition < Test::Unit::TestCase class TestAttachmentDefinition < Test::Unit::TestCase
context "Attachment definitions" do context "Attachment definitions" do
should "allow overriding options" do should "allow overriding options" do
not_expected = Paperclip::AttachmentDefinition.defaults[:file_path] not_expected = Paperclip::AttachmentDefinition.defaults[:path]
Paperclip::AttachmentDefinition.defaults[:file_path] = "123" Paperclip::AttachmentDefinition.defaults[:path] = "123"
assert_not_equal not_expected, Paperclip::AttachmentDefinition.defaults[:file_path] assert_not_equal not_expected, Paperclip::AttachmentDefinition.defaults[:path]
assert_equal "123", Paperclip::AttachmentDefinition.defaults[:file_path] assert_equal "123", Paperclip::AttachmentDefinition.defaults[:path]
end end
should "accept options that override defaults" do should "accept options that override defaults" do
@def = Paperclip::AttachmentDefinition.new "attachment", :file_path => "123", :delete_on_destroy => false @def = Paperclip::AttachmentDefinition.new "attachment", :path => "123", :delete_on_destroy => false
assert_not_equal Paperclip::AttachmentDefinition.defaults[:file_path], @def.path assert_not_equal Paperclip::AttachmentDefinition.defaults[:path], @def.path
assert_not_equal Paperclip::AttachmentDefinition.defaults[:delete_on_destroy], @def.delete_on_destroy assert_not_equal Paperclip::AttachmentDefinition.defaults[:delete_on_destroy], @def.delete_on_destroy
assert_equal "123", @def.path assert_equal "123", @def.path
assert_equal false, @def.delete_on_destroy assert_equal false, @def.delete_on_destroy
...@@ -22,7 +22,7 @@ class TestAttachmentDefinition < Test::Unit::TestCase ...@@ -22,7 +22,7 @@ class TestAttachmentDefinition < Test::Unit::TestCase
context "An attachment defintion" do context "An attachment defintion" do
setup do setup do
@options = { @options = {
:file_path => "/home/stuff/place", :path => "/home/stuff/place",
:url => "/attachments/:attachment/:name", :url => "/attachments/:attachment/:name",
:custom_definition => :boogie!, :custom_definition => :boogie!,
:thumbnails => {:thumb => "100x100", :large => "300x300>"}, :thumbnails => {:thumb => "100x100", :large => "300x300>"},
......
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