aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-14 13:36:58 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-14 13:36:58 -0300
commit51a52cb836a5aa7139c9563c9db9860d1db60c66 (patch)
treed9d089e755663304b39b85e27f625daa9e6b7799 /actionview/test
parent307a519d82a5870e4cff26338bb04272fbe7ab50 (diff)
parentb8ad4b54730bf52fbaeb2d172229cc412fd60561 (diff)
downloadrails-51a52cb836a5aa7139c9563c9db9860d1db60c66.tar.gz
rails-51a52cb836a5aa7139c9563c9db9860d1db60c66.tar.bz2
rails-51a52cb836a5aa7139c9563c9db9860d1db60c66.zip
Merge remote-tracking branch 'apotonick/simplify-prefixes'
This is the rebased version of #15026 Closes #15026
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/actionpack/abstract/abstract_controller_test.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/actionview/test/actionpack/abstract/abstract_controller_test.rb b/actionview/test/actionpack/abstract/abstract_controller_test.rb
index 40d3b17131..8a97b70901 100644
--- a/actionview/test/actionpack/abstract/abstract_controller_test.rb
+++ b/actionview/test/actionpack/abstract/abstract_controller_test.rb
@@ -150,6 +150,55 @@ module AbstractController
end
end
+ class OverridingLocalPrefixes < AbstractController::Base
+ include AbstractController::Rendering
+ include ActionView::Rendering
+ append_view_path File.expand_path(File.join(File.dirname(__FILE__), "views"))
+
+
+ def index
+ render
+ end
+
+ def self.local_prefixes
+ # this would usually return "abstract_controller/testing/overriding_local_prefixes"
+ super + ["abstract_controller/testing/me3"]
+ end
+
+ class Inheriting < self
+ end
+ end
+
+ class OverridingLocalPrefixesTest < ActiveSupport::TestCase # TODO: remove me in 5.0/4.3.
+ test "overriding ::local_prefixes adds prefix" do
+ @controller = OverridingLocalPrefixes.new
+ @controller.process(:index)
+ assert_equal "Hello from me3/index.erb", @controller.response_body
+ end
+
+ test "::local_prefixes is inherited" do
+ @controller = OverridingLocalPrefixes::Inheriting.new
+ @controller.process(:index)
+ assert_equal "Hello from me3/index.erb", @controller.response_body
+ end
+ end
+
+ class DeprecatedParentPrefixes < OverridingLocalPrefixes
+ def self.parent_prefixes
+ ["abstract_controller/testing/me3"]
+ end
+ end
+
+ class DeprecatedParentPrefixesTest < ActiveSupport::TestCase # TODO: remove me in 5.0/4.3.
+ test "overriding ::parent_prefixes is deprecated" do
+ @controller = DeprecatedParentPrefixes.new
+ assert_deprecated do
+ @controller.process(:index)
+ end
+ assert_equal "Hello from me3/index.erb", @controller.response_body
+ end
+ end
+
# Test rendering with layouts
# ====
# self._layout is used when defined