Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaning up more tests and code that needed to work in both old and n…

…ew base
  • Loading branch information...
commit 65102c8f1a55c8d73e44b62eed5e689017ace7cd 1 parent 55ee0ba
Yehuda Katz + Carl Lerche authored
1  actionpack/lib/action_view.rb
View
@@ -48,6 +48,7 @@ def self.load_all!
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
6 actionpack/test/controller/base_test.rb
View
@@ -146,11 +146,7 @@ def test_get_on_priv_should_show_selector
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
68 actionpack/test/controller/filters_test.rb
View
@@ -9,24 +9,20 @@ class << self
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 @@ def test_having_properties_in_around_filter
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 @@ def test_with_instance
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 @@ def test_nested_filters
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
19 actionpack/test/controller/helper_test.rb
View
@@ -127,11 +127,7 @@ def test_helper_for_acronym_controller
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 @@ def test_all_helpers_with_alternate_helper_dir
@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 @@ def expected_helper_methods
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
16 actionpack/test/controller/mime_responds_test.rb
View
@@ -519,16 +519,14 @@ def test_missing_layout_renders_properly
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
4 actionpack/test/controller/send_file_test.rb
View
@@ -45,8 +45,8 @@ def test_file_nostream
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
13 actionpack/test/template/body_parts_test.rb
View
@@ -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 @@ def index
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
Please sign in to comment.
Something went wrong with that request. Please try again.