diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-18 18:47:22 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-11-18 18:47:22 -0200 |
commit | 1b9e85dbbd7d974143e67affb3166d7244cc99db (patch) | |
tree | 66e446c1a6bf17c1873f34a97b404e92a232c67d /actionpack/test/controller | |
parent | edc39ff756d09b746bdc1acb8d814c3148289846 (diff) | |
download | rails-1b9e85dbbd7d974143e67affb3166d7244cc99db.tar.gz rails-1b9e85dbbd7d974143e67affb3166d7244cc99db.tar.bz2 rails-1b9e85dbbd7d974143e67affb3166d7244cc99db.zip |
Make sure assert_select can assert body tag
This reverts commit f93df52845766216f0fe36a4586f8abad505cac4, reversing
changes made to a455e3f4e9dbfb9630d47878e1239bc424fb7d13.
Conflicts:
actionpack/lib/action_controller/test_case.rb
actionview/lib/action_view/test_case.rb
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 27b30536b0..d6219b7626 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -292,7 +292,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest assert_equal({}, cookies.to_hash) assert_equal "OK", body assert_equal "OK", response.body - assert_kind_of Nokogiri::HTML::DocumentFragment, html_document + assert_kind_of Nokogiri::HTML::Document, html_document assert_equal 1, request_count end end @@ -308,7 +308,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest assert_equal({}, cookies.to_hash) assert_equal "Created", body assert_equal "Created", response.body - assert_kind_of Nokogiri::HTML::DocumentFragment, html_document + assert_kind_of Nokogiri::HTML::Document, html_document assert_equal 1, request_count end end @@ -368,7 +368,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest assert_response :redirect assert_response :found assert_equal "<html><body>You are being <a href=\"http://www.example.com/get\">redirected</a>.</body></html>", response.body - assert_kind_of Nokogiri::HTML::DocumentFragment, html_document + assert_kind_of Nokogiri::HTML::Document, html_document assert_equal 1, request_count follow_redirect! diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb index 957c0a5288..475af90032 100644 --- a/actionpack/test/controller/test_case_test.rb +++ b/actionpack/test/controller/test_case_test.rb @@ -132,6 +132,14 @@ XML render :nothing => true end + def test_without_body + render html: '<div class="foo"></div>'.html_safe + end + + def test_with_body + render html: '<body class="foo"></body>'.html_safe + end + private def generate_url(opts) @@ -179,6 +187,19 @@ XML end end + def test_assert_select_without_body + get :test_without_body + + assert_select 'body', 0 + assert_select 'div.foo' + end + + def test_assert_select_with_body + get :test_with_body + + assert_select 'body.foo' + end + def test_url_options_reset @controller = DefaultUrlOptionsCachingController.new get :test_url_options_reset |