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
def file_name style = nil
style ||= definition.default_style
interpolate( style, definition.file_path )
interpolate( style, definition.path )
end
def ensure_directories
......
......@@ -34,7 +34,6 @@ module Paperclip
http_host = definition.s3_host || "http://s3.amazonaws.com"
"#{http_host}/#{bucket}/#{url_without_s3(style)}"
end
alias_method_chain :url, :s3
def file_name style = nil
style ||= definition.default_style
......
......@@ -4,15 +4,15 @@ require File.dirname(__FILE__) + "/test_helper.rb"
class TestAttachmentDefinition < Test::Unit::TestCase
context "Attachment definitions" do
should "allow overriding options" do
not_expected = Paperclip::AttachmentDefinition.defaults[:file_path]
Paperclip::AttachmentDefinition.defaults[:file_path] = "123"
assert_not_equal not_expected, Paperclip::AttachmentDefinition.defaults[:file_path]
assert_equal "123", Paperclip::AttachmentDefinition.defaults[:file_path]
not_expected = Paperclip::AttachmentDefinition.defaults[:path]
Paperclip::AttachmentDefinition.defaults[:path] = "123"
assert_not_equal not_expected, Paperclip::AttachmentDefinition.defaults[:path]
assert_equal "123", Paperclip::AttachmentDefinition.defaults[:path]
end
should "accept options that override defaults" do
@def = Paperclip::AttachmentDefinition.new "attachment", :file_path => "123", :delete_on_destroy => false
assert_not_equal Paperclip::AttachmentDefinition.defaults[:file_path], @def.path
@def = Paperclip::AttachmentDefinition.new "attachment", :path => "123", :delete_on_destroy => false
assert_not_equal Paperclip::AttachmentDefinition.defaults[:path], @def.path
assert_not_equal Paperclip::AttachmentDefinition.defaults[:delete_on_destroy], @def.delete_on_destroy
assert_equal "123", @def.path
assert_equal false, @def.delete_on_destroy
......@@ -22,7 +22,7 @@ class TestAttachmentDefinition < Test::Unit::TestCase
context "An attachment defintion" do
setup do
@options = {
:file_path => "/home/stuff/place",
:path => "/home/stuff/place",
:url => "/attachments/:attachment/:name",
:custom_definition => :boogie!,
: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