mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove BasicRendering tests
This commit is contained in:
parent
67336ce199
commit
1385ae138d
3 changed files with 1 additions and 72 deletions
|
@ -10,14 +10,6 @@ module AbstractController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class UnsupportedOperationError < Error
|
|
||||||
DEFAULT_MESSAGE = "Unsupported render operation. BasicRendering supports only :text and :nothing options. For more, you need to include ActionView."
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
super DEFAULT_MESSAGE
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module Rendering
|
module Rendering
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
@ -55,7 +47,7 @@ module AbstractController
|
||||||
# Performs the actual template rendering.
|
# Performs the actual template rendering.
|
||||||
# :api: public
|
# :api: public
|
||||||
def render_to_body(options = {})
|
def render_to_body(options = {})
|
||||||
raise UnsupportedOperationError
|
raise NotImplementedError, "no render operation defined"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return Content-Type of rendered content
|
# Return Content-Type of rendered content
|
||||||
|
|
|
@ -13,7 +13,6 @@ module ActionController
|
||||||
autoload :Middleware
|
autoload :Middleware
|
||||||
|
|
||||||
autoload_under "metal" do
|
autoload_under "metal" do
|
||||||
autoload :BasicRendering, 'action_controller/metal/rendering'
|
|
||||||
autoload :Compatibility
|
autoload :Compatibility
|
||||||
autoload :ConditionalGet
|
autoload :ConditionalGet
|
||||||
autoload :Cookies
|
autoload :Cookies
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
require 'isolation/abstract_unit'
|
|
||||||
require 'rack/test'
|
|
||||||
|
|
||||||
module ApplicationTests
|
|
||||||
class BasicRenderingTest < ActiveSupport::TestCase
|
|
||||||
include ActiveSupport::Testing::Isolation
|
|
||||||
include Rack::Test::Methods
|
|
||||||
|
|
||||||
def setup
|
|
||||||
build_app
|
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
teardown_app
|
|
||||||
end
|
|
||||||
|
|
||||||
test "Rendering without ActionView" do
|
|
||||||
gsub_app_file 'config/application.rb', "require 'rails/all'", <<-RUBY
|
|
||||||
require "active_model/railtie"
|
|
||||||
require "action_controller/railtie"
|
|
||||||
RUBY
|
|
||||||
|
|
||||||
# Turn off ActionView and jquery-rails (it depends on AV)
|
|
||||||
$:.reject! {|path| path =~ /(actionview|jquery\-rails)/ }
|
|
||||||
boot_rails
|
|
||||||
|
|
||||||
app_file 'app/controllers/pages_controller.rb', <<-RUBY
|
|
||||||
class PagesController < ApplicationController
|
|
||||||
def render_hello_world
|
|
||||||
render text: "Hello World!"
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_nothing
|
|
||||||
render nothing: true
|
|
||||||
end
|
|
||||||
|
|
||||||
def no_render; end
|
|
||||||
|
|
||||||
def raise_error
|
|
||||||
render foo: "bar"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
RUBY
|
|
||||||
|
|
||||||
get '/pages/render_hello_world'
|
|
||||||
assert_equal 200, last_response.status
|
|
||||||
assert_equal "Hello World!", last_response.body
|
|
||||||
assert_equal "text/plain; charset=utf-8", last_response.content_type
|
|
||||||
|
|
||||||
get '/pages/render_nothing'
|
|
||||||
assert_equal 200, last_response.status
|
|
||||||
assert_equal " ", last_response.body
|
|
||||||
assert_equal "text/plain; charset=utf-8", last_response.content_type
|
|
||||||
|
|
||||||
get '/pages/no_render'
|
|
||||||
assert_equal 500, last_response.status
|
|
||||||
|
|
||||||
get '/pages/raise_error'
|
|
||||||
assert_equal 500, last_response.status
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue