aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/caching_test.rb15
-rw-r--r--actionpack/test/fixtures/layouts/block_with_layout.erb4
-rw-r--r--actionpack/test/fixtures/test/deprecated_nested_layout.erb3
-rw-r--r--actionpack/test/fixtures/test/nested_layout.erb2
-rw-r--r--actionpack/test/fixtures/test/using_layout_around_block.html.erb2
-rw-r--r--actionpack/test/template/erb/tag_helper_test.rb24
-rw-r--r--actionpack/test/template/render_test.rb8
7 files changed, 35 insertions, 23 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb
index a792752ef4..432433f976 100644
--- a/actionpack/test/controller/caching_test.rb
+++ b/actionpack/test/controller/caching_test.rb
@@ -617,7 +617,7 @@ class FragmentCachingTest < ActionController::TestCase
fragment_computed = false
buffer = 'generated till now -> '.html_safe
- @controller.fragment_for(buffer, 'expensive') { fragment_computed = true }
+ buffer << @controller.fragment_for('expensive') { fragment_computed = true }
assert fragment_computed
assert_equal 'generated till now -> ', buffer
@@ -628,7 +628,7 @@ class FragmentCachingTest < ActionController::TestCase
fragment_computed = false
buffer = 'generated till now -> '.html_safe
- @controller.fragment_for(buffer, 'expensive') { fragment_computed = true }
+ buffer << @controller.fragment_for('expensive') { fragment_computed = true }
assert !fragment_computed
assert_equal 'generated till now -> fragment content', buffer
@@ -742,15 +742,4 @@ CACHED
assert_equal " <p>Builder</p>\n", @store.read('views/test.host/functional_caching/formatted_fragment_cached')
end
-
- def test_js_formatted_fragment_caching
- get :formatted_fragment_cached, :format => "js"
- assert_response :success
- expected_body = %(title = "Hey";\n$("element_1").visualEffect("highlight");\n) +
- %($("element_2").visualEffect("highlight");\nfooter = "Bye";)
- assert_equal expected_body, @response.body
-
- assert_equal ['$("element_1").visualEffect("highlight");', '$("element_2").visualEffect("highlight");'],
- @store.read('views/test.host/functional_caching/formatted_fragment_cached')
- end
end
diff --git a/actionpack/test/fixtures/layouts/block_with_layout.erb b/actionpack/test/fixtures/layouts/block_with_layout.erb
index f25b41271d..73ac833e52 100644
--- a/actionpack/test/fixtures/layouts/block_with_layout.erb
+++ b/actionpack/test/fixtures/layouts/block_with_layout.erb
@@ -1,3 +1,3 @@
-<% render(:layout => "layout_for_partial", :locals => { :name => "Anthony" }) do %>Inside from first block in layout<% "Return value should be discarded" %><% end %>
+<%= render(:layout => "layout_for_partial", :locals => { :name => "Anthony" }) do %>Inside from first block in layout<% "Return value should be discarded" %><% end %>
<%= yield %>
-<% render(:layout => "layout_for_partial", :locals => { :name => "Ramm" }) do %>Inside from second block in layout<% end %>
+<%= render(:layout => "layout_for_partial", :locals => { :name => "Ramm" }) do %>Inside from second block in layout<% end %>
diff --git a/actionpack/test/fixtures/test/deprecated_nested_layout.erb b/actionpack/test/fixtures/test/deprecated_nested_layout.erb
new file mode 100644
index 0000000000..7b6dcbb6c7
--- /dev/null
+++ b/actionpack/test/fixtures/test/deprecated_nested_layout.erb
@@ -0,0 +1,3 @@
+<% content_for :title, "title" -%>
+<% content_for :column do -%>column<% end -%>
+<% render :layout => 'layouts/column' do -%>content<% end -%> \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/nested_layout.erb b/actionpack/test/fixtures/test/nested_layout.erb
index 7b6dcbb6c7..6078f74b4c 100644
--- a/actionpack/test/fixtures/test/nested_layout.erb
+++ b/actionpack/test/fixtures/test/nested_layout.erb
@@ -1,3 +1,3 @@
<% content_for :title, "title" -%>
<% content_for :column do -%>column<% end -%>
-<% render :layout => 'layouts/column' do -%>content<% end -%> \ No newline at end of file
+<%= render :layout => 'layouts/column' do -%>content<% end -%> \ No newline at end of file
diff --git a/actionpack/test/fixtures/test/using_layout_around_block.html.erb b/actionpack/test/fixtures/test/using_layout_around_block.html.erb
index a93fa02c9c..3d6661df9a 100644
--- a/actionpack/test/fixtures/test/using_layout_around_block.html.erb
+++ b/actionpack/test/fixtures/test/using_layout_around_block.html.erb
@@ -1 +1 @@
-<% render(:layout => "layout_for_partial", :locals => { :name => "David" }) do %>Inside from block<% end %> \ No newline at end of file
+<%= render(:layout => "layout_for_partial", :locals => { :name => "David" }) do %>Inside from block<% end %> \ No newline at end of file
diff --git a/actionpack/test/template/erb/tag_helper_test.rb b/actionpack/test/template/erb/tag_helper_test.rb
index cc96a43901..b5b7ae87de 100644
--- a/actionpack/test/template/erb/tag_helper_test.rb
+++ b/actionpack/test/template/erb/tag_helper_test.rb
@@ -20,7 +20,7 @@ module ERBTest
end
class DeprecatedViewContext < ViewContext
- include ActionView::Helpers::DeprecatedBlockHelpers
+ # include ActionView::Helpers::DeprecatedBlockHelpers
end
module SharedTagHelpers
@@ -31,28 +31,36 @@ module ERBTest
ActionView::Template::Handlers::Erubis.new(template).evaluate(context.new)
end
+ def maybe_deprecated
+ if @deprecated
+ assert_deprecated { yield }
+ else
+ yield
+ end
+ end
+
test "percent equals works for content_tag and does not require parenthesis on method call" do
- assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world")
+ maybe_deprecated { assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world") }
end
test "percent equals works for javascript_tag" do
expected_output = "<script type=\"text/javascript\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>"
- assert_equal expected_output, render_content("javascript_tag", "alert('Hello')")
+ maybe_deprecated { assert_equal expected_output, render_content("javascript_tag", "alert('Hello')") }
end
test "percent equals works for javascript_tag with options" do
expected_output = "<script id=\"the_js_tag\" type=\"text/javascript\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>"
- assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')")
+ maybe_deprecated { assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')") }
end
test "percent equals works with form tags" do
expected_output = "<form action=\"foo\" method=\"post\">hello</form>"
- assert_equal expected_output, render_content("form_tag('foo')", "<%= 'hello' %>")
+ maybe_deprecated { assert_equal expected_output, render_content("form_tag('foo')", "<%= 'hello' %>") }
end
test "percent equals works with fieldset tags" do
expected_output = "<fieldset><legend>foo</legend>hello</fieldset>"
- assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>")
+ maybe_deprecated { assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") }
end
end
@@ -77,6 +85,10 @@ module ERBTest
"<% __in_erb_template=true %><% #{str} do %>#{rest}<% end %>"
end
+ def setup
+ @deprecated = true
+ end
+
include SharedTagHelpers
end
end \ No newline at end of file
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index cea8ab1bce..e66202e8fe 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -228,6 +228,14 @@ module RenderTestCases
@view.render(:file => "test/hello_world.erb", :layout => "layouts/yield")
end
+ # TODO: Move to deprecated_tests.rb
+ def test_render_with_nested_layout_deprecated
+ assert_deprecated do
+ assert_equal %(<title>title</title>\n\n\n<div id="column">column</div>\n<div id="content">content</div>\n),
+ @view.render(:file => "test/deprecated_nested_layout.erb", :layout => "layouts/yield")
+ end
+ end
+
def test_render_with_nested_layout
assert_equal %(<title>title</title>\n\n\n<div id="column">column</div>\n<div id="content">content</div>\n),
@view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield")