Permalink
Browse files

Resurrecting 1.9 compatibility.

  • Loading branch information...
wycats committed Apr 13, 2009
1 parent 906aebc commit 647b83d50cba655422bcb83815f618b5a92bfc7d
@@ -174,7 +174,9 @@ def memoized_default_layout(formats) #:nodoc:
end
def default_layout(*args)
- (@_memoized_default_layout ||= ::ActiveSupport::ConcurrentHash.new)[args] ||= memoized_default_layout(*args)
+ memoized_default_layout(*args)
+ @_memoized_default_layout ||= ::ActiveSupport::ConcurrentHash.new
+ @_memoized_default_layout[args] ||= memoized_default_layout(*args)
end
def memoized_find_layout(layout, formats) #:nodoc:
@@ -184,7 +186,8 @@ def memoized_find_layout(layout, formats) #:nodoc:
end
def find_layout(*args)
- (@_memoized_find_layout ||= ::ActiveSupport::ConcurrentHash.new)[args] ||= memoized_find_layout(*args)
+ @_memoized_find_layout ||= ::ActiveSupport::ConcurrentHash.new
+ @_memoized_find_layout[args] ||= memoized_find_layout(*args)
end
def layout_list #:nodoc:
@@ -222,7 +225,7 @@ def active_layout(name)
self.class.find_layout(layout_name, formats)
end
- def _pick_layout(layout_name, implicit = false)
+ def _pick_layout(layout_name = nil, implicit = false)
return unless layout_name || implicit
layout_name = true if layout_name.nil?
active_layout(layout_name) if action_has_layout? && layout_name
@@ -370,7 +370,7 @@ def render_for_name(name, layout, options)
end
def render_for_parts(parts, layout, options = {})
- tmp = view_paths.find_by_parts(*parts)
+ tmp = view_paths.find_by_parts(*parts)
layout = _pick_layout(*layout) unless tmp.exempt_from_layout?
@@ -64,7 +64,7 @@ def #{render_symbol}(local_assigns)
end_src
begin
- ActionView::Base::CompiledTemplates.module_eval(source, filename, 0)
+ ActionView::Base::CompiledTemplates.module_eval(source, filename.to_s, 0)
rescue Exception => e # errors from template code
if logger = defined?(ActionController) && Base.logger
logger.debug "ERROR: compiling #{render_symbol} RAISED #{e}"
@@ -444,10 +444,10 @@ def render(*args)
end
get :using_defaults
- assert_equal "using_defaults - html", @response.body
+ assert_equal "using_defaults - #{[:html].to_s}", @response.body
get :using_defaults, :format => "xml"
- assert_equal "using_defaults - xml", @response.body
+ assert_equal "using_defaults - #{[:xml].to_s}", @response.body
end
def test_format_with_custom_response_type
@@ -9,6 +9,7 @@ def initialize(hash = {})
def []=(k,v)
@mutex.synchronize { @backup_cache[k] = v }
@frozen_cache = @backup_cache.dup.freeze
+ v
end
def [](k)
@@ -368,7 +368,8 @@ def _run_#{symbol}_callbacks(key = nil)
end
RUBY_EVAL
- class_eval str, __FILE__, __LINE__ + 1
+ undef_method "_run_#{symbol}_callbacks" if method_defined?("_run_#{symbol}_callbacks")
+ class_eval str, __FILE__, __LINE__
before_name, around_name, after_name =
options.values_at(:before, :after, :around)
@@ -16,7 +16,7 @@ def pending(description = "", &block)
begin
block.call
- rescue
+ rescue Exception
failed = true
end
@@ -1,6 +1,6 @@
require 'abstract_unit'
-class MemoizableTest < Test::Unit::TestCase
+class MemoizableTest < ActiveSupport::TestCase
class Person
extend ActiveSupport::Memoizable

0 comments on commit 647b83d

Please sign in to comment.