diff options
Diffstat (limited to 'actionpack/test/controller/new_base/render_template_test.rb')
-rw-r--r-- | actionpack/test/controller/new_base/render_template_test.rb | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/actionpack/test/controller/new_base/render_template_test.rb b/actionpack/test/controller/new_base/render_template_test.rb index b06ce5db40..1102305f3e 100644 --- a/actionpack/test/controller/new_base/render_template_test.rb +++ b/actionpack/test/controller/new_base/render_template_test.rb @@ -1,8 +1,7 @@ -require 'abstract_unit' +require "abstract_unit" module RenderTemplate class WithoutLayoutController < ActionController::Base - self.view_paths = [ActionView::FixtureResolver.new( "test/basic.html.erb" => "Hello from basic.html.erb", "shared.html.erb" => "Elastica", @@ -18,11 +17,11 @@ module RenderTemplate )] def index - render :template => "test/basic" + render template: "test/basic" end def html_with_json_inside_json - render :template => "test/with_json" + render template: "test/with_json" end def index_without_key @@ -30,46 +29,46 @@ module RenderTemplate end def in_top_directory - render :template => 'shared' + render template: "shared" end def in_top_directory_with_slash - render :template => '/shared' + render template: "/shared" end def in_top_directory_with_slash_without_key - render '/shared' + render "/shared" end def with_locals - render :template => "locals", :locals => { :secret => 'area51' } + render template: "locals", locals: { secret: "area51" } end def with_locals_without_key - render "locals", :locals => { :secret => 'area51' } + render "locals", locals: { secret: "area51" } end def builder_template - render :template => "xml_template" + render template: "xml_template" end def with_raw - render :template => "with_raw" + render template: "with_raw" end def with_implicit_raw - render :template => "with_implicit_raw" + render template: "with_implicit_raw" end def with_error - render :template => "test/with_error" + render template: "test/with_error" end private - def show_detailed_exceptions? - request.local? - end + def show_detailed_exceptions? + request.local? + end end class TestWithoutLayout < Rack::TestCase @@ -126,7 +125,7 @@ module RenderTemplate assert_body "Hello <strong>this is also raw</strong> in an html template" assert_status 200 - get :with_implicit_raw, params: { format: 'text' } + get :with_implicit_raw, params: { format: "text" } assert_body "Hello <strong>this is also raw</strong> in a text template" assert_status 200 @@ -154,30 +153,30 @@ module RenderTemplate )] def index - render :template => "test/basic" + render template: "test/basic" end def with_layout - render :template => "test/basic", :layout => true + render template: "test/basic", layout: true end def with_layout_false - render :template => "test/basic", :layout => false + render template: "test/basic", layout: false end def with_layout_nil - render :template => "test/basic", :layout => nil + render template: "test/basic", layout: nil end def with_custom_layout - render :template => "test/basic", :layout => "greetings" + render template: "test/basic", layout: "greetings" end end class TestWithLayout < Rack::TestCase test "rendering with implicit layout" do with_routing do |set| - set.draw { get ':controller', :action => :index } + set.draw { ActiveSupport::Deprecation.silence { get ":controller", action: :index } } get "/render_template/with_layout" @@ -223,7 +222,7 @@ module RenderTemplate )] def with_forward_slash - render :template => "/test/basic" + render template: "/test/basic" end end |