diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-27 16:43:25 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-27 16:49:04 -0700 |
commit | bd7e3dc47d8ab4da1028c9c18c94474178f84bdd (patch) | |
tree | 5645d358e9eb2e26aad42ea38e8ba823c0452770 | |
parent | e70bd6bdfae3615a013cf6252efdea3d94c5b64c (diff) | |
download | rails-bd7e3dc47d8ab4da1028c9c18c94474178f84bdd.tar.gz rails-bd7e3dc47d8ab4da1028c9c18c94474178f84bdd.tar.bz2 rails-bd7e3dc47d8ab4da1028c9c18c94474178f84bdd.zip |
Added a compatibility layer to get legacy filter tests to pass on new base
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index bdcc24b371..b0b7274690 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -1,10 +1,32 @@ require 'abstract_unit' +require 'active_support/core_ext/symbol' -class << ActionController::Base - %w(append_around_filter prepend_after_filter prepend_around_filter prepend_before_filter skip_after_filter skip_before_filter skip_filter).each do |pending| - define_method(pending) do |*args| - $stderr.puts "#{pending} unimplemented: #{args.inspect}" - end unless method_defined?(pending) +class ActionController::Base + class << self + %w(append_around_filter prepend_after_filter prepend_around_filter prepend_before_filter skip_after_filter skip_before_filter skip_filter).each do |pending| + define_method(pending) do |*args| + $stderr.puts "#{pending} unimplemented: #{args.inspect}" + end unless method_defined?(pending) + end + + if defined?(ActionController::Http) + def before_filters + filters = _process_action_callbacks.select { |c| c.kind == :before } + filters.map! { |c| c.instance_variable_get(:@raw_filter) } + end + end + end + + if defined?(ActionController::Http) + def assigns(key = nil) + assigns = {} + instance_variable_names.each do |ivar| + next if ActionController::Base.protected_instance_variables.include?(ivar) + assigns[ivar[1..-1]] = instance_variable_get(ivar) + end + + key.nil? ? assigns : assigns[key.to_s] + end end end |