Commit 09767ab1 by Jon Yurek

Reversed commit 87783829, removed :relative_url_root for now

parent 28a83058
......@@ -209,13 +209,6 @@ module Paperclip
end,
:attachment => lambda{|attachment,style| attachment.name.to_s.downcase.pluralize },
:style => lambda{|attachment,style| style || attachment.default_style },
:relative_root => lambda do |attachment,style|
if ActionController::AbstractRequest.respond_to?(:relative_url_root)
ActionController::AbstractRequest.relative_url_root
elsif ActionController::Base.respond_to?(:relative_url_root)
ActionController::Base.relative_url_root
end
end
}
end
......
......@@ -106,36 +106,6 @@ class AttachmentTest < Test::Unit::TestCase
end
end
context "An attachment with a :relative_root interpolation" do
setup do
rebuild_model :url => ":relative_root/:id.png"
@dummy = Dummy.new
@dummy.stubs(:id).returns(1024)
@dummy.avatar = StringIO.new(".")
ActionController::Base.stubs(:respond_to?).with(:relative_url_root).returns(false)
ActionController::Base.stubs(:relative_url_root).returns("/base")
ActionController::AbstractRequest.stubs(:respond_to?).with(:relative_url_root).returns(false)
ActionController::AbstractRequest.stubs(:relative_url_root).returns("/request")
end
should "return the proper path when the path is nil" do
assert_equal "/1024.png", @dummy.avatar.url(:original, false)
end
should "return the proper path when using Rails < 2.1" do
ActionController::AbstractRequest.expects(:respond_to?).with(:relative_url_root).returns(true)
ActionController::AbstractRequest.expects(:relative_url_root).returns("/request")
assert_equal "/request/1024.png", @dummy.avatar.url(:original, false)
end
should "return the proper path when using Rails >= 2.1" do
ActionController::Base.expects(:respond_to?).with(:relative_url_root).returns(true)
ActionController::Base.expects(:relative_url_root).returns("/base")
assert_equal "/base/1024.png", @dummy.avatar.url(:original, false)
end
end
context "An attachment with :convert_options" do
setup do
rebuild_model :styles => {
......
......@@ -9,7 +9,6 @@ gem 'sqlite3-ruby'
require 'active_record'
require 'active_support'
require 'action_controller'
begin
require 'ruby-debug'
rescue LoadError
......
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