1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove deprecated support to :text in render

This commit is contained in:
Rafael Mendonça França 2016-05-21 09:49:38 -03:00
parent 57e1c99a28
commit 79a5ea9ead
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
21 changed files with 84 additions and 293 deletions

View file

@ -11,8 +11,8 @@ class AssertSelectEmailTest < ActionMailer::TestCase
class AssertMultipartSelectMailer < ActionMailer::Base class AssertMultipartSelectMailer < ActionMailer::Base
def test(options) def test(options)
mail subject: "Test e-mail", from: "test@test.host", to: "test <test@test.host>" do |format| mail subject: "Test e-mail", from: "test@test.host", to: "test <test@test.host>" do |format|
format.text { render text: options[:text] } format.text { render plain: options[:text] }
format.html { render text: options[:html] } format.html { render plain: options[:html] }
end end
end end
end end

View file

@ -18,7 +18,7 @@ end
class TestController < ActionController::Base class TestController < ActionController::Base
def send_mail def send_mail
email = I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver_now email = I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver_now
render text: "Mail sent - Subject: #{email.subject}" render plain: "Mail sent - Subject: #{email.subject}"
end end
end end

View file

@ -62,8 +62,8 @@ class BaseMailer < ActionMailer::Base
def explicit_multipart(hash = {}) def explicit_multipart(hash = {})
attachments["invoice.pdf"] = "This is test File content" if hash.delete(:attachments) attachments["invoice.pdf"] = "This is test File content" if hash.delete(:attachments)
mail(hash) do |format| mail(hash) do |format|
format.text { render text: "TEXT Explicit Multipart" } format.text { render plain: "TEXT Explicit Multipart" }
format.html { render text: "HTML Explicit Multipart" } format.html { render plain: "HTML Explicit Multipart" }
end end
end end
@ -76,7 +76,7 @@ class BaseMailer < ActionMailer::Base
def explicit_multipart_with_any(hash = {}) def explicit_multipart_with_any(hash = {})
mail(hash) do |format| mail(hash) do |format|
format.any(:text, :html) { render text: "Format with any!" } format.any(:text, :html) { render plain: "Format with any!" }
end end
end end

View file

@ -1,3 +1,7 @@
* Remove deprecated support to `:text` in `render`.
*Rafael Mendonça França*
* Remove deprecated support to `:nothing` in `render`. * Remove deprecated support to `:nothing` in `render`.
*Rafael Mendonça França* *Rafael Mendonça França*

View file

@ -4,7 +4,7 @@ module ActionController
module Rendering module Rendering
extend ActiveSupport::Concern extend ActiveSupport::Concern
RENDER_FORMATS_IN_PRIORITY = [:body, :text, :plain, :html] RENDER_FORMATS_IN_PRIORITY = [:body, :plain, :html]
module ClassMethods module ClassMethods
# Documentation at ActionController::Renderer#render # Documentation at ActionController::Renderer#render
@ -83,17 +83,6 @@ module ActionController
def _normalize_options(options) #:nodoc: def _normalize_options(options) #:nodoc:
_normalize_text(options) _normalize_text(options)
if options[:text]
ActiveSupport::Deprecation.warn <<-WARNING.squish
`render :text` is deprecated because it does not actually render a
`text/plain` response. Switch to `render plain: 'plain text'` to
render as `text/plain`, `render html: '<strong>HTML</strong>'` to
render as `text/html`, or `render body: 'raw'` to match the deprecated
behavior and render with the default Content-Type, which is
`text/html`.
WARNING
end
if options[:html] if options[:html]
options[:html] = ERB::Util.html_escape(options[:html]) options[:html] = ERB::Util.html_escape(options[:html])
end end

View file

@ -23,10 +23,6 @@ class RenderersApiController < ActionController::API
def plain def plain
render plain: "Hi from plain", status: 500 render plain: "Hi from plain", status: 500
end end
def text
render text: "Hi from text", status: 500
end
end end
class RenderersApiTest < ActionController::TestCase class RenderersApiTest < ActionController::TestCase
@ -49,12 +45,4 @@ class RenderersApiTest < ActionController::TestCase
assert_response :internal_server_error assert_response :internal_server_error
assert_equal("Hi from plain", @response.body) assert_equal("Hi from plain", @response.body)
end end
def test_render_text
assert_deprecated do
get :text
end
assert_response :internal_server_error
assert_equal("Hi from text", @response.body)
end
end end

View file

@ -1,188 +0,0 @@
require "abstract_unit"
module RenderText
class MinimalController < ActionController::Metal
include AbstractController::Rendering
include ActionController::Rendering
def index
render text: "Hello World!"
end
end
class SimpleController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new]
def index
render text: "hello david"
end
end
class WithLayoutController < ::ApplicationController
self.view_paths = [ActionView::FixtureResolver.new(
"layouts/application.html.erb" => "<%= yield %>, I'm here!",
"layouts/greetings.html.erb" => "<%= yield %>, I wish thee well.",
"layouts/ivar.html.erb" => "<%= yield %>, <%= @ivar %>"
)]
def index
render text: "hello david"
end
def custom_code
render text: "hello world", status: 404
end
def with_custom_code_as_string
render text: "hello world", status: "404 Not Found"
end
def with_nil
render text: nil
end
def with_nil_and_status
render text: nil, status: 403
end
def with_false
render text: false
end
def with_layout_true
render text: "hello world", layout: true
end
def with_layout_false
render text: "hello world", layout: false
end
def with_layout_nil
render text: "hello world", layout: nil
end
def with_custom_layout
render text: "hello world", layout: "greetings"
end
def with_ivar_in_layout
@ivar = "hello world"
render text: "hello world", layout: "ivar"
end
end
class RenderTextTest < Rack::TestCase
test "rendering text from a minimal controller" do
ActiveSupport::Deprecation.silence do
get "/render_text/minimal/index"
end
assert_body "Hello World!"
assert_status 200
end
test "rendering text from an action with default options renders the text with the layout" do
with_routing do |set|
set.draw { ActiveSupport::Deprecation.silence { get ":controller", action: "index" } }
ActiveSupport::Deprecation.silence do
get "/render_text/simple"
end
assert_body "hello david"
assert_status 200
end
end
test "rendering text from an action with default options renders the text without the layout" do
with_routing do |set|
set.draw { ActiveSupport::Deprecation.silence { get ":controller", action: "index" } }
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout"
end
assert_body "hello david"
assert_status 200
end
end
test "rendering text, while also providing a custom status code" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/custom_code"
end
assert_body "hello world"
assert_status 404
end
test "rendering text with nil returns an empty body" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_nil"
end
assert_body ""
assert_status 200
end
test "Rendering text with nil and custom status code returns an empty body and the status" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_nil_and_status"
end
assert_body ""
assert_status 403
end
test "rendering text with false returns the string 'false'" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_false"
end
assert_body "false"
assert_status 200
end
test "rendering text with layout: true" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_layout_true"
end
assert_body "hello world, I'm here!"
assert_status 200
end
test "rendering text with layout: 'greetings'" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_custom_layout"
end
assert_body "hello world, I wish thee well."
assert_status 200
end
test "rendering text with layout: false" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_layout_false"
end
assert_body "hello world"
assert_status 200
end
test "rendering text with layout: nil" do
ActiveSupport::Deprecation.silence do
get "/render_text/with_layout/with_layout_nil"
end
assert_body "hello world"
assert_status 200
end
test "rendering text displays deprecation warning" do
assert_deprecated do
get "/render_text/with_layout/with_layout_nil"
end
end
end
end

View file

@ -426,7 +426,7 @@ module ActionView
end end
def _include_layout?(options) def _include_layout?(options)
(options.keys & [:body, :text, :plain, :html, :inline, :partial]).empty? || options.key?(:layout) (options.keys & [:body, :plain, :html, :inline, :partial]).empty? || options.key?(:layout)
end end
end end
end end

View file

@ -22,8 +22,6 @@ module ActionView
if options.key?(:body) if options.key?(:body)
Template::Text.new(options[:body]) Template::Text.new(options[:body])
elsif options.key?(:text)
Template::Text.new(options[:text], formats.first)
elsif options.key?(:plain) elsif options.key?(:plain)
Template::Text.new(options[:plain]) Template::Text.new(options[:plain])
elsif options.key?(:html) elsif options.key?(:html)
@ -40,7 +38,7 @@ module ActionView
find_template(options[:template], options[:prefixes], false, keys, @details) find_template(options[:template], options[:prefixes], false, keys, @details)
end end
else else
raise ArgumentError, "You invoked render but did not give any of :partial, :template, :inline, :file, :plain, :html, :text or :body option." raise ArgumentError, "You invoked render but did not give any of :partial, :template, :inline, :file, :plain, :html or :body option."
end end
end end

View file

@ -55,7 +55,7 @@ class AVLogSubscriberTest < ActiveSupport::TestCase
def test_render_text_template def test_render_text_template
Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do Rails.stub(:root, File.expand_path(FIXTURE_LOAD_PATH)) do
@view.render(text: "TEXT") @view.render(plain: "TEXT")
wait wait
assert_equal 2, @logger.logged(:info).size assert_equal 2, @logger.logged(:info).size

View file

@ -285,7 +285,7 @@ module ActionView
class AssertionsTest < ActionView::TestCase class AssertionsTest < ActionView::TestCase
def render_from_helper def render_from_helper
form_tag("/foo") do form_tag("/foo") do
safe_concat render(text: "<ul><li>foo</li></ul>") safe_concat render(plain: "<ul><li>foo</li></ul>")
end end
end end
helper_method :render_from_helper helper_method :render_from_helper

View file

@ -375,7 +375,7 @@ module ApplicationTests
class ::OmgController < ActionController::Base class ::OmgController < ActionController::Base
def index def index
flash[:cool_story] = true flash[:cool_story] = true
render text: "ok" render plain: "ok"
end end
end end

View file

@ -398,7 +398,7 @@ module ApplicationTests
class ::OmgController < ActionController::Base class ::OmgController < ActionController::Base
def index def index
cookies.signed[:some_key] = "some_value" cookies.signed[:some_key] = "some_value"
render text: cookies[:some_key] render plain: cookies[:some_key]
end end
end end
@ -704,7 +704,7 @@ module ApplicationTests
end end
def update def update
render text: "update" render plain: "update"
end end
private private
@ -978,7 +978,7 @@ module ApplicationTests
class ::OmgController < ActionController::Base class ::OmgController < ActionController::Base
def index def index
render text: env["action_dispatch.show_exceptions"] render plain: env["action_dispatch.show_exceptions"]
end end
end end
@ -1008,7 +1008,7 @@ module ApplicationTests
app_file "app/controllers/posts_controller.rb", <<-RUBY app_file "app/controllers/posts_controller.rb", <<-RUBY
class PostsController < ApplicationController class PostsController < ApplicationController
def create def create
render text: params[:post].inspect render plain: params[:post].inspect
end end
end end
RUBY RUBY
@ -1029,7 +1029,7 @@ module ApplicationTests
app_file "app/controllers/posts_controller.rb", <<-RUBY app_file "app/controllers/posts_controller.rb", <<-RUBY
class PostsController < ActionController::Base class PostsController < ActionController::Base
def create def create
render text: params[:post].permitted? ? "permitted" : "forbidden" render plain: params[:post].permitted? ? "permitted" : "forbidden"
end end
end end
RUBY RUBY
@ -1051,7 +1051,7 @@ module ApplicationTests
app_file "app/controllers/posts_controller.rb", <<-RUBY app_file "app/controllers/posts_controller.rb", <<-RUBY
class PostsController < ActionController::Base class PostsController < ActionController::Base
def create def create
render text: params.require(:post).permit(:name) render plain: params.require(:post).permit(:name)
end end
end end
RUBY RUBY
@ -1090,7 +1090,7 @@ module ApplicationTests
app_file "app/controllers/posts_controller.rb", <<-RUBY app_file "app/controllers/posts_controller.rb", <<-RUBY
class PostsController < ActionController::Base class PostsController < ActionController::Base
def create def create
render text: params.permit(post: [:title]) render plain: params.permit(post: [:title])
end end
end end
RUBY RUBY
@ -1137,8 +1137,8 @@ module ApplicationTests
class ::OmgController < ActionController::Base class ::OmgController < ActionController::Base
def index def index
respond_to do |format| respond_to do |format|
format.html { render text: "HTML" } format.html { render plain: "HTML" }
format.xml { render text: "XML" } format.xml { render plain: "XML" }
end end
end end
end end

View file

@ -19,7 +19,7 @@ module ApplicationTests
class ExpiresController < ApplicationController class ExpiresController < ApplicationController
def expires_header def expires_header
expires_in 10, public: !params[:private] expires_in 10, public: !params[:private]
render text: SecureRandom.hex(16) render plain: SecureRandom.hex(16)
end end
def expires_etag def expires_etag
@ -32,12 +32,12 @@ module ApplicationTests
end end
def keeps_if_modified_since def keeps_if_modified_since
render :text => request.headers['If-Modified-Since'] render plain: request.headers['If-Modified-Since']
end end
private private
def render_conditionally(headers) def render_conditionally(headers)
if stale?(headers.merge(public: !params[:private])) if stale?(headers.merge(public: !params[:private]))
render text: SecureRandom.hex(16) render plain: SecureRandom.hex(16)
end end
end end
end end

View file

@ -70,7 +70,7 @@ module ApplicationTests
end end
def read_session def read_session
render text: session[:foo].inspect render plain: session[:foo].inspect
end end
end end
RUBY RUBY
@ -111,7 +111,7 @@ module ApplicationTests
end end
def read_cookie def read_cookie
render text: cookies[:foo].inspect render plain: cookies[:foo].inspect
end end
end end
RUBY RUBY
@ -149,15 +149,15 @@ module ApplicationTests
end end
def read_session def read_session
render text: session[:foo] render plain: session[:foo]
end end
def read_encrypted_cookie def read_encrypted_cookie
render text: cookies.encrypted[:_myapp_session]['foo'] render plain: cookies.encrypted[:_myapp_session]['foo']
end end
def read_raw_cookie def read_raw_cookie
render text: cookies[:_myapp_session] render plain: cookies[:_myapp_session]
end end
end end
RUBY RUBY
@ -194,15 +194,15 @@ module ApplicationTests
end end
def read_session def read_session
render text: session[:foo] render plain: session[:foo]
end end
def read_encrypted_cookie def read_encrypted_cookie
render text: cookies.encrypted[:_myapp_session]['foo'] render plain: cookies.encrypted[:_myapp_session]['foo']
end end
def read_raw_cookie def read_raw_cookie
render text: cookies[:_myapp_session] render plain: cookies[:_myapp_session]
end end
end end
RUBY RUBY
@ -249,15 +249,15 @@ module ApplicationTests
end end
def read_session def read_session
render text: session[:foo] render plain: session[:foo]
end end
def read_encrypted_cookie def read_encrypted_cookie
render text: cookies.encrypted[:_myapp_session]['foo'] render plain: cookies.encrypted[:_myapp_session]['foo']
end end
def read_raw_cookie def read_raw_cookie
render text: cookies[:_myapp_session] render plain: cookies[:_myapp_session]
end end
end end
RUBY RUBY
@ -308,15 +308,15 @@ module ApplicationTests
end end
def read_session def read_session
render text: session[:foo] render plain: session[:foo]
end end
def read_signed_cookie def read_signed_cookie
render text: cookies.signed[:_myapp_session]['foo'] render plain: cookies.signed[:_myapp_session]['foo']
end end
def read_raw_cookie def read_raw_cookie
render text: cookies[:_myapp_session] render plain: cookies[:_myapp_session]
end end
end end
RUBY RUBY

View file

@ -227,9 +227,9 @@ module ApplicationTests
class ::OmgController < ActionController::Base class ::OmgController < ActionController::Base
def index def index
if params[:nothing] if params[:nothing]
render text: "" render plain: ""
else else
render text: "OMG" render plain: "OMG"
end end
end end
end end
@ -239,7 +239,7 @@ module ApplicationTests
get "/" get "/"
assert_equal 200, last_response.status assert_equal 200, last_response.status
assert_equal "OMG", last_response.body assert_equal "OMG", last_response.body
assert_equal "text/html; charset=utf-8", last_response.headers["Content-Type"] assert_equal "text/plain; charset=utf-8", last_response.headers["Content-Type"]
assert_equal "max-age=0, private, must-revalidate", last_response.headers["Cache-Control"] assert_equal "max-age=0, private, must-revalidate", last_response.headers["Cache-Control"]
assert_equal etag, last_response.headers["Etag"] assert_equal etag, last_response.headers["Etag"]
@ -253,7 +253,7 @@ module ApplicationTests
get "/?nothing=true" get "/?nothing=true"
assert_equal 200, last_response.status assert_equal 200, last_response.status
assert_equal "", last_response.body assert_equal "", last_response.body
assert_equal "text/html; charset=utf-8", last_response.headers["Content-Type"] assert_equal "text/plain; charset=utf-8", last_response.headers["Content-Type"]
assert_equal "no-cache", last_response.headers["Cache-Control"] assert_equal "no-cache", last_response.headers["Cache-Control"]
assert_equal nil, last_response.headers["Etag"] assert_equal nil, last_response.headers["Etag"]
end end

View file

@ -65,7 +65,7 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -156,7 +156,7 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: my_blog_path render plain: my_blog_path
end end
end end
RUBY RUBY
@ -176,7 +176,7 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -184,7 +184,7 @@ module ApplicationTests
controller :bar, <<-RUBY controller :bar, <<-RUBY
class BarController < ActionController::Base class BarController < ActionController::Base
def index def index
render text: "bar" render plain: "bar"
end end
end end
RUBY RUBY
@ -206,7 +206,7 @@ module ApplicationTests
controller "foo", <<-RUBY controller "foo", <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -215,7 +215,7 @@ module ApplicationTests
module Admin module Admin
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "admin::foo" render plain: "admin::foo"
end end
end end
end end
@ -268,11 +268,11 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def bar def bar
render text: "bar" render plain: "bar"
end end
def baz def baz
render text: "baz" render plain: "baz"
end end
end end
RUBY RUBY
@ -332,7 +332,7 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render :text => "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -356,7 +356,7 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -364,7 +364,7 @@ module ApplicationTests
controller :bar, <<-RUBY controller :bar, <<-RUBY
class BarController < ApplicationController class BarController < ApplicationController
def index def index
render text: "bar" render plain: "bar"
end end
end end
RUBY RUBY
@ -427,7 +427,7 @@ module ApplicationTests
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -435,7 +435,7 @@ module ApplicationTests
controller :bar, <<-RUBY controller :bar, <<-RUBY
class BarController < ApplicationController class BarController < ApplicationController
def index def index
render text: "bar" render plain: "bar"
end end
end end
RUBY RUBY
@ -482,7 +482,7 @@ module ApplicationTests
controller "yazilar", <<-RUBY controller "yazilar", <<-RUBY
class YazilarController < ApplicationController class YazilarController < ApplicationController
def index def index
render text: 'yazilar#index' render plain: 'yazilar#index'
end end
end end
RUBY RUBY

View file

@ -27,7 +27,7 @@ module ApplicationTests
class ::OmgController < ::ApplicationController class ::OmgController < ::ApplicationController
def index def index
render text: omg_path render plain: omg_path
end end
end end

View file

@ -187,7 +187,7 @@ module TestHelpers
controller :foo, <<-RUBY controller :foo, <<-RUBY
class FooController < ApplicationController class FooController < ApplicationController
def index def index
render text: "foo" render plain: "foo"
end end
end end
RUBY RUBY

View file

@ -327,7 +327,7 @@ module RailtiesTest
controller "foo", <<-RUBY controller "foo", <<-RUBY
class FooController < ActionController::Base class FooController < ActionController::Base
def index def index
render :text => "foo" render plain: "foo"
end end
end end
RUBY RUBY
@ -341,7 +341,7 @@ module RailtiesTest
@plugin.write "app/controllers/bar_controller.rb", <<-RUBY @plugin.write "app/controllers/bar_controller.rb", <<-RUBY
class BarController < ActionController::Base class BarController < ActionController::Base
def index def index
render :text => "bar" render plain: "bar"
end end
end end
RUBY RUBY
@ -436,7 +436,7 @@ YAML
@plugin.write "app/controllers/admin/foo/bar_controller.rb", <<-RUBY @plugin.write "app/controllers/admin/foo/bar_controller.rb", <<-RUBY
class Admin::Foo::BarController < ApplicationController class Admin::Foo::BarController < ApplicationController
def index def index
render text: "Rendered from namespace" render plain: "Rendered from namespace"
end end
end end
RUBY RUBY
@ -536,7 +536,7 @@ YAML
controller "foo", <<-RUBY controller "foo", <<-RUBY
class FooController < ActionController::Base class FooController < ActionController::Base
def index def index
render text: params[:username] render plain: params[:username]
end end
end end
RUBY RUBY
@ -700,7 +700,7 @@ YAML
end end
def show def show
render text: foo_path render plain: foo_path
end end
def from_app def from_app
@ -712,7 +712,7 @@ YAML
end end
def polymorphic_path_without_namespace def polymorphic_path_without_namespace
render text: polymorphic_path(Post.new) render plain: polymorphic_path(Post.new)
end end
end end
RUBY RUBY
@ -835,7 +835,7 @@ YAML
@plugin.write "app/controllers/bukkits/awesome/foo_controller.rb", <<-RUBY @plugin.write "app/controllers/bukkits/awesome/foo_controller.rb", <<-RUBY
class Bukkits::Awesome::FooController < ActionController::Base class Bukkits::Awesome::FooController < ActionController::Base
def index def index
render :text => "ok" render plain: "ok"
end end
end end
RUBY RUBY
@ -1220,7 +1220,7 @@ YAML
fullpath: \#{request.fullpath} fullpath: \#{request.fullpath}
path: \#{request.path} path: \#{request.path}
TEXT TEXT
render text: text render plain: text
end end
end end
end end
@ -1257,7 +1257,7 @@ YAML
app_file "app/controllers/bar_controller.rb", <<-RUBY app_file "app/controllers/bar_controller.rb", <<-RUBY
class BarController < ApplicationController class BarController < ApplicationController
def index def index
render text: bukkits.bukkit_path render plain: bukkits.bukkit_path
end end
end end
RUBY RUBY
@ -1278,7 +1278,7 @@ YAML
@plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY @plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY
class Bukkits::BukkitController < ActionController::Base class Bukkits::BukkitController < ActionController::Base
def index def index
render text: main_app.bar_path render plain: main_app.bar_path
end end
end end
RUBY RUBY
@ -1306,7 +1306,7 @@ YAML
app_file "app/controllers/bar_controller.rb", <<-RUBY app_file "app/controllers/bar_controller.rb", <<-RUBY
class BarController < ApplicationController class BarController < ApplicationController
def index def index
render text: bukkits.bukkit_path render plain: bukkits.bukkit_path
end end
end end
RUBY RUBY
@ -1327,7 +1327,7 @@ YAML
@plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY @plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY
class Bukkits::BukkitController < ActionController::Base class Bukkits::BukkitController < ActionController::Base
def index def index
render text: main_app.bar_path render plain: main_app.bar_path
end end
end end
RUBY RUBY

View file

@ -50,7 +50,7 @@ module ApplicationTests
@simple_plugin.write "app/controllers/weblogs_controller.rb", <<-RUBY @simple_plugin.write "app/controllers/weblogs_controller.rb", <<-RUBY
class WeblogsController < ActionController::Base class WeblogsController < ActionController::Base
def index def index
render text: request.url render plain: request.url
end end
end end
RUBY RUBY
@ -74,7 +74,7 @@ module ApplicationTests
module Metrics module Metrics
class GeneratingController < ActionController::Base class GeneratingController < ActionController::Base
def generate_blog_route def generate_blog_route
render text: blog.post_path(1) render plain: blog.post_path(1)
end end
def generate_blog_route_in_view def generate_blog_route_in_view
@ -122,14 +122,14 @@ module ApplicationTests
module Blog module Blog
class PostsController < ActionController::Base class PostsController < ActionController::Base
def index def index
render text: blog.post_path(1) render plain: blog.post_path(1)
end end
def generate_application_route def generate_application_route
path = main_app.url_for(controller: "/main", path = main_app.url_for(controller: "/main",
action: "index", action: "index",
only_path: true) only_path: true)
render text: path render plain: path
end end
def application_route_in_view def application_route_in_view
@ -137,7 +137,7 @@ module ApplicationTests
end end
def engine_polymorphic_path def engine_polymorphic_path
render text: polymorphic_path(Post.new) render plain: polymorphic_path(Post.new)
end end
def engine_asset_path def engine_asset_path
@ -150,7 +150,7 @@ module ApplicationTests
app_file "app/controllers/application_generating_controller.rb", <<-RUBY app_file "app/controllers/application_generating_controller.rb", <<-RUBY
class ApplicationGeneratingController < ActionController::Base class ApplicationGeneratingController < ActionController::Base
def engine_route def engine_route
render text: blog.posts_path render plain: blog.posts_path
end end
def engine_route_in_view def engine_route_in_view
@ -158,7 +158,7 @@ module ApplicationTests
end end
def weblog_engine_route def weblog_engine_route
render text: weblog.weblogs_path render plain: weblog.weblogs_path
end end
def weblog_engine_route_in_view def weblog_engine_route_in_view
@ -166,15 +166,15 @@ module ApplicationTests
end end
def url_for_engine_route def url_for_engine_route
render text: blog.url_for(controller: "blog/posts", action: "index", user: "john", only_path: true) render plain: blog.url_for(controller: "blog/posts", action: "index", user: "john", only_path: true)
end end
def polymorphic_route def polymorphic_route
render text: polymorphic_url([blog, Blog::Post.new]) render plain: polymorphic_url([blog, Blog::Post.new])
end end
def application_polymorphic_path def application_polymorphic_path
render text: polymorphic_path(Blog::Post.new) render plain: polymorphic_path(Blog::Post.new)
end end
end end
RUBY RUBY