aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/metal/testing.rb5
-rw-r--r--actionpack/lib/action_controller/test_case.rb1
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb8
-rw-r--r--actionpack/lib/action_view/renderer/partial_renderer.rb6
-rw-r--r--actionpack/test/controller/default_url_options_with_filter_test.rb29
-rw-r--r--actionpack/test/controller/helper_test.rb1
-rw-r--r--actionpack/test/controller/routing_test.rb1
-rw-r--r--actionpack/test/template/form_helper_test.rb2
-rw-r--r--actionpack/test/template/render_test.rb4
9 files changed, 45 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/metal/testing.rb b/actionpack/lib/action_controller/metal/testing.rb
index f4efeb33ba..d1813ee745 100644
--- a/actionpack/lib/action_controller/metal/testing.rb
+++ b/actionpack/lib/action_controller/metal/testing.rb
@@ -4,6 +4,11 @@ module ActionController
include RackDelegation
+ def recycle!
+ @_url_options = nil
+ end
+
+
# TODO: Clean this up
def process_with_new_base_test(request, response)
@_request = request
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 45bb641aee..c8cf04bb69 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -450,6 +450,7 @@ module ActionController
@controller.params.merge!(parameters)
build_request_uri(action, parameters)
@controller.class.class_eval { include Testing }
+ @controller.recycle!
@controller.process_with_new_base_test(@request, @response)
@assigns = @controller.respond_to?(:view_assigns) ? @controller.view_assigns : {}
@request.session.delete('flash') if @request.session['flash'].blank?
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 85dea96bbb..f22c466666 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1227,12 +1227,12 @@ module ActionView
parent_builder.multipart = multipart if parent_builder
end
- def self._to_path
- @_to_path ||= name.demodulize.underscore.sub!(/_builder$/, '')
+ def self._to_partial_path
+ @_to_partial_path ||= name.demodulize.underscore.sub!(/_builder$/, '')
end
- def to_path
- self.class._to_path
+ def to_partial_path
+ self.class._to_partial_path
end
def to_model
diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb
index f67388b8cf..cd0f7054a9 100644
--- a/actionpack/lib/action_view/renderer/partial_renderer.rb
+++ b/actionpack/lib/action_view/renderer/partial_renderer.rb
@@ -364,10 +364,10 @@ module ActionView
def partial_path(object = @object)
object = object.to_model if object.respond_to?(:to_model)
- path = if object.respond_to?(:to_path)
- object.to_path
+ path = if object.respond_to?(:to_partial_path)
+ object.to_partial_path
else
- ActiveSupport::Deprecation.warn "ActiveModel-compatible objects whose classes return a #model_name that responds to #partial_path are deprecated. Please respond to #to_path directly instead."
+ ActiveSupport::Deprecation.warn "ActiveModel-compatible objects whose classes return a #model_name that responds to #partial_path are deprecated. Please respond to #to_partial_path directly instead."
object.class.model_name.partial_path
end
diff --git a/actionpack/test/controller/default_url_options_with_filter_test.rb b/actionpack/test/controller/default_url_options_with_filter_test.rb
new file mode 100644
index 0000000000..3bbb981040
--- /dev/null
+++ b/actionpack/test/controller/default_url_options_with_filter_test.rb
@@ -0,0 +1,29 @@
+require 'abstract_unit'
+
+
+class ControllerWithBeforeFilterAndDefaultUrlOptions < ActionController::Base
+
+ before_filter { I18n.locale = params[:locale] }
+ after_filter { I18n.locale = "en" }
+
+ def target
+ render :text => "final response"
+ end
+
+ def redirect
+ redirect_to :action => "target"
+ end
+
+ def default_url_options
+ {:locale => "de"}
+ end
+end
+
+class ControllerWithBeforeFilterAndDefaultUrlOptionsTest < ActionController::TestCase
+
+ # This test has it´s roots in issue #1872
+ test "should redirect with correct locale :de" do
+ get :redirect, :locale => "de"
+ assert_redirected_to "/controller_with_before_filter_and_default_url_options/target?locale=de"
+ end
+end
diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb
index 584d73668a..35a87c1aae 100644
--- a/actionpack/test/controller/helper_test.rb
+++ b/actionpack/test/controller/helper_test.rb
@@ -1,5 +1,4 @@
require 'abstract_unit'
-require 'active_support/core_ext/kernel/reporting'
ActionController::Base.helpers_path = File.expand_path('../../fixtures/helpers', __FILE__)
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index aa9d193436..b693fbec2b 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1,7 +1,6 @@
# encoding: utf-8
require 'abstract_unit'
require 'controller/fake_controllers'
-require 'active_support/dependencies'
require 'active_support/core_ext/object/with_options'
class MilestonesController < ActionController::Base
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 71a2c46d92..f898c22e1e 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -1895,7 +1895,7 @@ class FormHelperTest < ActionView::TestCase
path = nil
form_for(@post, :builder => LabelledFormBuilder) do |f|
- path = f.to_path
+ path = f.to_partial_path
''
end
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 0b91e55091..6f02f8662d 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -214,14 +214,14 @@ module RenderTestCases
end
def test_render_partial_using_object_with_deprecated_partial_path
- assert_deprecated(/#model_name.*#partial_path.*#to_path/) do
+ assert_deprecated(/#model_name.*#partial_path.*#to_partial_path/) do
assert_equal "Hello: nertzy",
@controller_view.render(CustomerWithDeprecatedPartialPath.new("nertzy"), :greeting => "Hello")
end
end
def test_render_partial_using_collection_with_deprecated_partial_path
- assert_deprecated(/#model_name.*#partial_path.*#to_path/) do
+ assert_deprecated(/#model_name.*#partial_path.*#to_partial_path/) do
customers = [
CustomerWithDeprecatedPartialPath.new("nertzy"),
CustomerWithDeprecatedPartialPath.new("peeja")