diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/actionpack.gemspec | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/base.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 2 | ||||
-rw-r--r-- | actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb | 2 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 6 | ||||
-rw-r--r-- | actionpack/test/template/text_helper_test.rb | 18 |
6 files changed, 20 insertions, 12 deletions
diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index 02ff908c1c..8e95315252 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| s.add_dependency('i18n', '~> 0.4.1') s.add_dependency('rack', '~> 1.1.0') s.add_dependency('rack-test', '~> 0.5.4') - s.add_dependency('rack-mount', '~> 0.6.3') + s.add_dependency('rack-mount', '~> 0.6.4') s.add_dependency('tzinfo', '~> 0.3.16') s.add_dependency('erubis', '~> 2.6.5') end diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index b7f404f5d8..4d06ca0d89 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -2,7 +2,7 @@ require 'active_support/core_ext/module/attr_internal' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/class/attribute' require 'active_support/core_ext/array/wrap' -require 'active_support/ordered_options.rb' +require 'active_support/ordered_options' module ActionView #:nodoc: class NonConcattingString < ActiveSupport::SafeBuffer diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index 4198013f57..4d35296932 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -56,7 +56,7 @@ module ActionView :identifier => template.identifier, :layout => layout.try(:virtual_path)) do content = template.render(self, locals) { |*name| _layout_for(*name) } - @_content_for[:layout] = content + @_content_for[:layout] = content if layout content = _render_layout(layout, locals) if layout content diff --git a/actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb b/actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb new file mode 100644 index 0000000000..7298d79690 --- /dev/null +++ b/actionpack/test/fixtures/layouts/yield_with_render_inline_inside.erb @@ -0,0 +1,2 @@ +<%= render :inline => 'welcome' %> +<%= yield %> diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index aca96e0a24..059dcedad8 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -229,6 +229,12 @@ module RenderTestCases @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield") end + def test_render_with_layout_which_has_render_inline + assert_equal %(welcome\nHello world!\n), + @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield_with_render_inline_inside") + end + + # TODO: Move to deprecated_tests.rb def test_render_with_nested_layout_deprecated assert_deprecated do diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 108cf510ff..b0a4c2a9cc 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -40,15 +40,15 @@ class TextHelperTest < ActionView::TestCase assert simple_format("<b> test with html tags </b>").html_safe? end - def test_simple_format_should_sanitize_unsafe_input + def test_simple_format_should_escape_unsafe_input assert_equal "<p><b> test with unsafe string </b><script>code!</script></p>", simple_format("<b> test with unsafe string </b><script>code!</script>") end - def test_simple_format_should_not_sanitize_input_if_safe_option + def test_simple_format_should_not_escape_input_if_safe_option assert_equal "<p><b> test with unsafe string </b><script>code!</script></p>", simple_format("<b> test with unsafe string </b><script>code!</script>", {}, :safe => true) end - def test_simple_format_should_not_sanitize_safe_input + def test_simple_format_should_not_escape_safe_input assert_equal "<p><b> test with safe string </b></p>", simple_format("<b> test with safe string </b>".html_safe) end @@ -61,16 +61,16 @@ class TextHelperTest < ActionView::TestCase assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12) end - def test_truncate_should_sanitize_unsafe_input + def test_truncate_should_escape_unsafe_input assert_equal "Hello <...", truncate("Hello <script>code!</script>World!!", :length => 12) end - def test_truncate_should_not_sanitize_input_if_safe_option + def test_truncate_should_not_escape_input_if_safe_option assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!", :length => 12, :safe => true) assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!!", :length => 12, :safe => true) end - def test_truncate_should_not_sanitize_safe_input + def test_truncate_should_not_escape_safe_input assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!".html_safe, :length => 12) assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!!".html_safe, :length => 12) end @@ -138,21 +138,21 @@ class TextHelperTest < ActionView::TestCase assert_equal ' ', highlight(' ', 'blank text is returned verbatim') end - def test_highlight_should_sanitize_unsafe_input + def test_highlight_should_escape_unsafe_input assert_equal( "This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>", highlight("This is a beautiful morning<script>code!</script>", "beautiful") ) end - def test_highlight_should_not_sanitize_input_if_safe_option + def test_highlight_should_not_escape_input_if_safe_option assert_equal( "This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>", highlight("This is a beautiful morning<script>code!</script>", "beautiful", :safe => true) ) end - def test_highlight_should_not_sanitize_safe_input + def test_highlight_should_not_escape_safe_input assert_equal( "This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>", highlight("This is a beautiful morning<script>code!</script>".html_safe, "beautiful") |