aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-07-22 22:19:17 +0200
committerYves Senn <yves.senn@gmail.com>2014-07-22 22:19:17 +0200
commit74a157ac5f0955ce3472ddeca578a9f2d69b0a98 (patch)
treefa2e26b1c51507d10689bb986725ad496eb7b547 /actionpack/test
parent1db00698da05558f3ed48a9d1dce6ca0996c056e (diff)
parentd14f64699715d24a7ceb33e6ef8fa14127716c24 (diff)
downloadrails-74a157ac5f0955ce3472ddeca578a9f2d69b0a98.tar.gz
rails-74a157ac5f0955ce3472ddeca578a9f2d69b0a98.tar.bz2
rails-74a157ac5f0955ce3472ddeca578a9f2d69b0a98.zip
Merge pull request #16234 from tgxworld/fix_template_assertion_for_integration_test
Fix AC::TemplateAssertions instance variables not resetting.
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/template_assertions_test.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/template_assertions_test.rb b/actionpack/test/dispatch/template_assertions_test.rb
new file mode 100644
index 0000000000..b8bc8e22d4
--- /dev/null
+++ b/actionpack/test/dispatch/template_assertions_test.rb
@@ -0,0 +1,58 @@
+require 'abstract_unit'
+
+class AssertTemplateController < ActionController::Base
+ def render_with_partial
+ render partial: 'test/partial'
+ end
+
+ def render_with_template
+ render 'test/hello_world'
+ end
+
+ def render_with_layout
+ @variable_for_layout = nil
+ render 'test/hello_world', layout: "layouts/standard"
+ end
+
+ def render_with_file
+ render file: 'README.rdoc'
+ end
+
+ def render_nothing
+ head :ok
+ end
+end
+
+class AssertTemplateControllerTest < ActionDispatch::IntegrationTest
+ def test_assert_template_reset_between_requests
+ get '/assert_template/render_with_template'
+ assert_template 'test/hello_world'
+
+ get '/assert_template/render_nothing'
+ assert_template nil
+ end
+
+ def test_assert_partial_reset_between_requests
+ get '/assert_template/render_with_partial'
+ assert_template partial: 'test/_partial'
+
+ get '/assert_template/render_nothing'
+ assert_template partial: nil
+ end
+
+ def test_assert_layout_reset_between_requests
+ get '/assert_template/render_with_layout'
+ assert_template layout: 'layouts/standard'
+
+ get '/assert_template/render_nothing'
+ assert_template layout: nil
+ end
+
+ def test_assert_file_reset_between_requests
+ get '/assert_template/render_with_file'
+ assert_template file: 'README.rdoc'
+
+ get '/assert_template/render_nothing'
+ assert_template file: nil
+ end
+end