aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/content_type_test.rb
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikac.hu>2015-07-17 21:48:00 -0400
committerPrem Sichanugrist <s@sikac.hu>2015-07-17 22:27:33 -0400
commit8cb8ce98d903929342e2ca3a54a07ab5196baf93 (patch)
treedeae317ebeca2cb20b57e9ad9a8c0c36720c8d7f /actionpack/test/controller/content_type_test.rb
parent0db98b3ec8226042a5c3400d594d803abb5b169f (diff)
downloadrails-8cb8ce98d903929342e2ca3a54a07ab5196baf93.tar.gz
rails-8cb8ce98d903929342e2ca3a54a07ab5196baf93.tar.bz2
rails-8cb8ce98d903929342e2ca3a54a07ab5196baf93.zip
Stop using deprecated `render :text` in test
This will silence deprecation warnings. Most of the test can be changed from `render :text` to render `:plain` or `render :body` right away. However, there are some tests that needed to be fixed by hand as they actually assert the default Content-Type returned from `render :body`.
Diffstat (limited to 'actionpack/test/controller/content_type_test.rb')
-rw-r--r--actionpack/test/controller/content_type_test.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/actionpack/test/controller/content_type_test.rb b/actionpack/test/controller/content_type_test.rb
index 89667df3a4..c5bbc479c9 100644
--- a/actionpack/test/controller/content_type_test.rb
+++ b/actionpack/test/controller/content_type_test.rb
@@ -4,29 +4,29 @@ class OldContentTypeController < ActionController::Base
# :ported:
def render_content_type_from_body
response.content_type = Mime::RSS
- render :text => "hello world!"
+ render body: "hello world!"
end
# :ported:
def render_defaults
- render :text => "hello world!"
+ render body: "hello world!"
end
# :ported:
def render_content_type_from_render
- render :text => "hello world!", :content_type => Mime::RSS
+ render body: "hello world!", :content_type => Mime::RSS
end
# :ported:
def render_charset_from_body
response.charset = "utf-16"
- render :text => "hello world!"
+ render body: "hello world!"
end
# :ported:
def render_nil_charset_from_body
response.charset = nil
- render :text => "hello world!"
+ render body: "hello world!"
end
def render_default_for_erb
@@ -42,10 +42,10 @@ class OldContentTypeController < ActionController::Base
def render_default_content_types_for_respond_to
respond_to do |format|
- format.html { render :text => "hello world!" }
- format.xml { render :action => "render_default_content_types_for_respond_to" }
- format.js { render :text => "hello world!" }
- format.rss { render :text => "hello world!", :content_type => Mime::XML }
+ format.html { render body: "hello world!" }
+ format.xml { render action: "render_default_content_types_for_respond_to" }
+ format.js { render body: "hello world!" }
+ format.rss { render body: "hello world!", content_type: Mime::XML }
end
end
end
@@ -64,14 +64,14 @@ class ContentTypeTest < ActionController::TestCase
def test_render_defaults
get :render_defaults
assert_equal "utf-8", @response.charset
- assert_equal Mime::HTML, @response.content_type
+ assert_equal Mime::TEXT, @response.content_type
end
def test_render_changed_charset_default
with_default_charset "utf-16" do
get :render_defaults
assert_equal "utf-16", @response.charset
- assert_equal Mime::HTML, @response.content_type
+ assert_equal Mime::TEXT, @response.content_type
end
end
@@ -92,14 +92,14 @@ class ContentTypeTest < ActionController::TestCase
# :ported:
def test_charset_from_body
get :render_charset_from_body
- assert_equal Mime::HTML, @response.content_type
+ assert_equal Mime::TEXT, @response.content_type
assert_equal "utf-16", @response.charset
end
# :ported:
def test_nil_charset_from_body
get :render_nil_charset_from_body
- assert_equal Mime::HTML, @response.content_type
+ assert_equal Mime::TEXT, @response.content_type
assert_equal "utf-8", @response.charset, @response.headers.inspect
end