aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-17 16:51:51 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-06-17 16:51:51 -0700
commit65102c8f1a55c8d73e44b62eed5e689017ace7cd (patch)
tree27714a7b1c13c1a347dd827ed4cf0abc53f0fcaa
parent55ee0ba7f5b6b5d2023eb5dcc030946ed589fe53 (diff)
downloadrails-65102c8f1a55c8d73e44b62eed5e689017ace7cd.tar.gz
rails-65102c8f1a55c8d73e44b62eed5e689017ace7cd.tar.bz2
rails-65102c8f1a55c8d73e44b62eed5e689017ace7cd.zip
Cleaning up more tests and code that needed to work in both old and new base
-rw-r--r--actionpack/lib/action_view.rb1
-rw-r--r--actionpack/test/controller/base_test.rb6
-rw-r--r--actionpack/test/controller/filters_test.rb68
-rw-r--r--actionpack/test/controller/helper_test.rb19
-rw-r--r--actionpack/test/controller/mime_responds_test.rb16
-rw-r--r--actionpack/test/controller/send_file_test.rb4
-rw-r--r--actionpack/test/template/body_parts_test.rb13
7 files changed, 37 insertions, 90 deletions
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index 3e3b68c71d..27a06db5bb 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -48,6 +48,7 @@ module ActionView
autoload :TemplateHandlers, 'action_view/template/handlers'
autoload :TextTemplate, 'action_view/template/text'
autoload :Helpers, 'action_view/helpers'
+ autoload :FileSystemResolverWithFallback, 'action_view/template/resolver'
end
class ERB
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 03fd98a85c..8877057070 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -146,11 +146,7 @@ class PerformActionTest < ActionController::TestCase
def test_method_missing_is_not_an_action_name
use_controller MethodMissingController
- if defined?(ActionController::Http)
- assert ! @controller.__send__(:action_method?, 'method_missing')
- else
- assert ! @controller.__send__(:action_methods).include?('method_missing')
- end
+ assert ! @controller.__send__(:action_method?, 'method_missing')
get :method_missing
assert_response :success
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index b930ff4997..2da97a9d86 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -9,24 +9,20 @@ class ActionController::Base
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
+ def before_filters
+ filters = _process_action_callbacks.select { |c| c.kind == :before }
+ filters.map! { |c| c.instance_variable_get(:@raw_filter) }
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]
+ 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
@@ -598,22 +594,11 @@ class FilterTest < ActionController::TestCase
assert_equal "before and after", assigns["execution_log"]
end
- for_tag(:old_base) do
- def test_prepending_and_appending_around_filter
- controller = test_process(MixedFilterController)
- assert_equal " before aroundfilter before procfilter before appended aroundfilter " +
- " after appended aroundfilter after aroundfilter after procfilter ",
- MixedFilterController.execution_log
- end
- end
-
- for_tag(:new_base) do
- def test_prepending_and_appending_around_filter
- controller = test_process(MixedFilterController)
- assert_equal " before aroundfilter before procfilter before appended aroundfilter " +
- " after appended aroundfilter after procfilter after aroundfilter ",
- MixedFilterController.execution_log
- end
+ def test_prepending_and_appending_around_filter
+ controller = test_process(MixedFilterController)
+ assert_equal " before aroundfilter before procfilter before appended aroundfilter " +
+ " after appended aroundfilter after procfilter after aroundfilter ",
+ MixedFilterController.execution_log
end
def test_rendering_breaks_filtering_chain
@@ -876,14 +861,6 @@ class YieldingAroundFiltersTest < ActionController::TestCase
assert_raise(After) { test_process(controller,'raises_after') }
end
- for_tag(:old_base) do
- def test_with_method
- controller = ControllerWithFilterMethod
- assert_nothing_raised { test_process(controller,'no_raise') }
- assert_raise(After) { test_process(controller,'raises_after') }
- end
- end
-
def test_with_proc
test_process(ControllerWithProcFilter,'no_raise')
assert assigns['before']
@@ -906,18 +883,9 @@ class YieldingAroundFiltersTest < ActionController::TestCase
end
end
- for_tag(:old_base) do
- def test_filter_order_with_all_filter_types
- test_process(ControllerWithAllTypesOfFilters,'no_raise')
- assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) around (after yield) after', assigns['ran_filter'].join(' ')
- end
- end
-
- for_tag(:new_base) do
- def test_filter_order_with_all_filter_types
- test_process(ControllerWithAllTypesOfFilters,'no_raise')
- assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) after around (after yield)', assigns['ran_filter'].join(' ')
- end
+ def test_filter_order_with_all_filter_types
+ test_process(ControllerWithAllTypesOfFilters,'no_raise')
+ assert_equal 'before around (before yield) around_again (before yield) around_again (after yield) after around (after yield)', assigns['ran_filter'].join(' ')
end
def test_filter_order_with_skip_filter_method
diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb
index 515c4c9f52..23149fee27 100644
--- a/actionpack/test/controller/helper_test.rb
+++ b/actionpack/test/controller/helper_test.rb
@@ -127,11 +127,7 @@ class HelperTest < Test::Unit::TestCase
end
def test_all_helpers
- methods = if defined?(ActionController::Http)
- AllHelpersController._helpers.instance_methods.map {|m| m.to_s}
- else
- AllHelpersController.master_helper_module.instance_methods.map {|m| m.to_s}
- end
+ methods = AllHelpersController._helpers.instance_methods.map {|m| m.to_s}
# abc_helper.rb
assert methods.include?('bare_a')
@@ -147,12 +143,7 @@ class HelperTest < Test::Unit::TestCase
@controller_class.helpers_dir = File.dirname(__FILE__) + '/../fixtures/alternate_helpers'
# Reload helpers
- if defined?(ActionController::Http)
- @controller_class._helpers = Module.new
- else
- @controller_class.master_helper_module = Module.new
- end
-
+ @controller_class._helpers = Module.new
@controller_class.helper :all
# helpers/abc_helper.rb should not be included
@@ -184,11 +175,7 @@ class HelperTest < Test::Unit::TestCase
end
def master_helper_methods
- if defined?(ActionController::Http)
- @controller_class._helpers.instance_methods.map {|m| m.to_s }
- else
- @controller_class.master_helper_module.instance_methods.map {|m| m.to_s }
- end
+ @controller_class._helpers.instance_methods.map {|m| m.to_s }
end
def missing_methods
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index c9994ee013..93ca34c41c 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -519,16 +519,14 @@ class MimeControllerLayoutsTest < ActionController::TestCase
assert_equal 'Hello iPhone', @response.body
end
- for_tag(:old_base) do
- def test_format_with_inherited_layouts
- @controller = SuperPostController.new
+ def test_format_with_inherited_layouts
+ @controller = SuperPostController.new
- get :index
- assert_equal 'Super Firefox', @response.body
+ get :index
+ assert_equal '<html><div id="html">Super Firefox</div></html>', @response.body
- @request.accept = "text/iphone"
- get :index
- assert_equal '<html><div id="super_iphone">Super iPhone</div></html>', @response.body
- end
+ @request.accept = "text/iphone"
+ get :index
+ assert_equal '<html><div id="super_iphone">Super iPhone</div></html>', @response.body
end
end
diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb
index 4134da3b9e..d88d5c5dac 100644
--- a/actionpack/test/controller/send_file_test.rb
+++ b/actionpack/test/controller/send_file_test.rb
@@ -45,8 +45,8 @@ class SendFileTest < ActionController::TestCase
assert_equal file_data, response.body
end
- for_tag(:old_base) do
- def test_file_stream
+ def test_file_stream
+ pending do
response = nil
assert_nothing_raised { response = process('file') }
assert_not_nil response
diff --git a/actionpack/test/template/body_parts_test.rb b/actionpack/test/template/body_parts_test.rb
index 4e7aa63f96..bac67c1a7d 100644
--- a/actionpack/test/template/body_parts_test.rb
+++ b/actionpack/test/template/body_parts_test.rb
@@ -4,9 +4,8 @@ class BodyPartsTest < ActionController::TestCase
RENDERINGS = [Object.new, Object.new, Object.new]
class TestController < ActionController::Base
- def performed?
- defined?(ActionController::Http) ? true : super
- end
+ def performed?() true end
+
def index
RENDERINGS.each do |rendering|
@template.punctuate_body! rendering
@@ -19,11 +18,9 @@ class BodyPartsTest < ActionController::TestCase
def test_body_parts
get :index
- pending(:old_base) do
- # TestProcess buffers body_parts into body
- # TODO: Rewrite test w/o going through process
- assert_equal RENDERINGS, @response.body_parts
- end
+ # TestProcess buffers body_parts into body
+ # TODO: Rewrite test w/o going through process
+ assert_equal RENDERINGS, @response.body_parts
assert_equal RENDERINGS.join, @response.body
end
end