aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/test/actionpack')
-rw-r--r--actionview/test/actionpack/abstract/abstract_controller_test.rb10
-rw-r--r--actionview/test/actionpack/abstract/helper_test.rb6
-rw-r--r--actionview/test/actionpack/abstract/layouts_test.rb46
-rw-r--r--actionview/test/actionpack/abstract/render_test.rb6
-rw-r--r--actionview/test/actionpack/controller/capture_test.rb8
-rw-r--r--actionview/test/actionpack/controller/layout_test.rb14
-rw-r--r--actionview/test/actionpack/controller/render_test.rb192
-rw-r--r--actionview/test/actionpack/controller/view_paths_test.rb8
8 files changed, 145 insertions, 145 deletions
diff --git a/actionview/test/actionpack/abstract/abstract_controller_test.rb b/actionview/test/actionpack/abstract/abstract_controller_test.rb
index c320b2bbf7..1480445fc5 100644
--- a/actionview/test/actionpack/abstract/abstract_controller_test.rb
+++ b/actionview/test/actionpack/abstract/abstract_controller_test.rb
@@ -38,7 +38,7 @@ module AbstractController
def render(options = {})
if options.is_a?(String)
- options = {:_template_name => options}
+ options = {_template_name: options}
end
super
end
@@ -65,11 +65,11 @@ module AbstractController
end
def rendering_to_body
- self.response_body = render_to_body :template => "naked_render"
+ self.response_body = render_to_body template: "naked_render"
end
def rendering_to_string
- self.response_body = render_to_string :template => "naked_render"
+ self.response_body = render_to_string template: "naked_render"
end
end
@@ -190,10 +190,10 @@ module AbstractController
private
def self.layout(formats)
- find_template(name.underscore, {:formats => formats}, :_prefixes => ["layouts"])
+ find_template(name.underscore, {formats: formats}, _prefixes: ["layouts"])
rescue ActionView::MissingTemplate
begin
- find_template("application", {:formats => formats}, :_prefixes => ["layouts"])
+ find_template("application", {formats: formats}, _prefixes: ["layouts"])
rescue ActionView::MissingTemplate
end
end
diff --git a/actionview/test/actionpack/abstract/helper_test.rb b/actionview/test/actionpack/abstract/helper_test.rb
index d6b9e9ddf1..a6c79f0308 100644
--- a/actionview/test/actionpack/abstract/helper_test.rb
+++ b/actionview/test/actionpack/abstract/helper_test.rb
@@ -11,7 +11,7 @@ module AbstractController
include ActionView::Rendering
def with_module
- render :inline => "Module <%= included_method %>"
+ render inline: "Module <%= included_method %>"
end
end
@@ -31,11 +31,11 @@ module AbstractController
helper :abc
def with_block
- render :inline => "Hello <%= helpery_test %>"
+ render inline: "Hello <%= helpery_test %>"
end
def with_symbol
- render :inline => "I respond to bare_a: <%= respond_to?(:bare_a) %>"
+ render inline: "I respond to bare_a: <%= respond_to?(:bare_a) %>"
end
end
diff --git a/actionview/test/actionpack/abstract/layouts_test.rb b/actionview/test/actionpack/abstract/layouts_test.rb
index 0031036d85..e9352dcc35 100644
--- a/actionview/test/actionpack/abstract/layouts_test.rb
+++ b/actionview/test/actionpack/abstract/layouts_test.rb
@@ -30,7 +30,7 @@ module AbstractControllerTests
self.view_paths = []
def index
- render :template => ActionView::Template::Text.new("Hello blank!")
+ render template: ActionView::Template::Text.new("Hello blank!")
end
end
@@ -38,7 +38,7 @@ module AbstractControllerTests
layout "hello_locals"
def index
- render :template => "some/template", locals: { foo: "less than 3" }
+ render template: "some/template", locals: { foo: "less than 3" }
end
end
@@ -46,7 +46,7 @@ module AbstractControllerTests
layout "hello"
def index
- render :template => ActionView::Template::Text.new("Hello string!")
+ render template: ActionView::Template::Text.new("Hello string!")
end
def action_has_layout_false
@@ -54,15 +54,15 @@ module AbstractControllerTests
end
def overwrite_default
- render :template => ActionView::Template::Text.new("Hello string!"), :layout => :default
+ render template: ActionView::Template::Text.new("Hello string!"), layout: :default
end
def overwrite_false
- render :template => ActionView::Template::Text.new("Hello string!"), :layout => false
+ render template: ActionView::Template::Text.new("Hello string!"), layout: false
end
def overwrite_string
- render :template => ActionView::Template::Text.new("Hello string!"), :layout => "overwrite"
+ render template: ActionView::Template::Text.new("Hello string!"), layout: "overwrite"
end
def overwrite_skip
@@ -92,7 +92,7 @@ module AbstractControllerTests
layout proc { "overwrite" }
def index
- render :template => ActionView::Template::Text.new("Hello proc!")
+ render template: ActionView::Template::Text.new("Hello proc!")
end
end
@@ -116,7 +116,7 @@ module AbstractControllerTests
layout proc { "overwrite" }
def index
- render :template => ActionView::Template::Text.new("Hello zero arity proc!")
+ render template: ActionView::Template::Text.new("Hello zero arity proc!")
end
end
@@ -129,7 +129,7 @@ module AbstractControllerTests
}
def index
- render :template => ActionView::Template::Text.new("Hello again zero arity proc!")
+ render template: ActionView::Template::Text.new("Hello again zero arity proc!")
end
end
@@ -137,7 +137,7 @@ module AbstractControllerTests
layout :hello
def index
- render :template => ActionView::Template::Text.new("Hello symbol!")
+ render template: ActionView::Template::Text.new("Hello symbol!")
end
private
def hello
@@ -149,7 +149,7 @@ module AbstractControllerTests
layout :nilz
def index
- render :template => ActionView::Template::Text.new("Hello nilz!")
+ render template: ActionView::Template::Text.new("Hello nilz!")
end
def nilz() end
@@ -159,7 +159,7 @@ module AbstractControllerTests
layout :objekt
def index
- render :template => ActionView::Template::Text.new("Hello nilz!")
+ render template: ActionView::Template::Text.new("Hello nilz!")
end
def objekt
@@ -171,7 +171,7 @@ module AbstractControllerTests
layout :no_method
def index
- render :template => ActionView::Template::Text.new("Hello boom!")
+ render template: ActionView::Template::Text.new("Hello boom!")
end
end
@@ -179,7 +179,7 @@ module AbstractControllerTests
layout "missing"
def index
- render :template => ActionView::Template::Text.new("Hello missing!")
+ render template: ActionView::Template::Text.new("Hello missing!")
end
end
@@ -187,7 +187,7 @@ module AbstractControllerTests
layout false
def index
- render :template => ActionView::Template::Text.new("Hello false!")
+ render template: ActionView::Template::Text.new("Hello false!")
end
end
@@ -195,19 +195,19 @@ module AbstractControllerTests
layout nil
def index
- render :template => ActionView::Template::Text.new("Hello nil!")
+ render template: ActionView::Template::Text.new("Hello nil!")
end
end
class WithOnlyConditional < WithStringImpliedChild
- layout "overwrite", :only => :show
+ layout "overwrite", only: :show
def index
- render :template => ActionView::Template::Text.new("Hello index!")
+ render template: ActionView::Template::Text.new("Hello index!")
end
def show
- render :template => ActionView::Template::Text.new("Hello show!")
+ render template: ActionView::Template::Text.new("Hello show!")
end
end
@@ -220,14 +220,14 @@ module AbstractControllerTests
end
class WithExceptConditional < WithStringImpliedChild
- layout "overwrite", :except => :show
+ layout "overwrite", except: :show
def index
- render :template => ActionView::Template::Text.new("Hello index!")
+ render template: ActionView::Template::Text.new("Hello index!")
end
def show
- render :template => ActionView::Template::Text.new("Hello show!")
+ render template: ActionView::Template::Text.new("Hello show!")
end
end
@@ -294,7 +294,7 @@ module AbstractControllerTests
10.times do |x|
controller = WithString.new
controller.define_singleton_method :index do
- render :template => ActionView::Template::Text.new("Hello string!"), :locals => { :"x#{x}" => :omg }
+ render template: ActionView::Template::Text.new("Hello string!"), locals: { :"x#{x}" => :omg }
end
controller.process(:index)
end
diff --git a/actionview/test/actionpack/abstract/render_test.rb b/actionview/test/actionpack/abstract/render_test.rb
index 06f7996780..c658f5ae58 100644
--- a/actionview/test/actionpack/abstract/render_test.rb
+++ b/actionview/test/actionpack/abstract/render_test.rb
@@ -21,15 +21,15 @@ module AbstractController
)]
def template
- render :template => "template"
+ render template: "template"
end
def file
- render :file => "some/file"
+ render file: "some/file"
end
def inline
- render :inline => "With <%= :Inline %>"
+ render inline: "With <%= :Inline %>"
end
def text
diff --git a/actionview/test/actionpack/controller/capture_test.rb b/actionview/test/actionpack/controller/capture_test.rb
index eda604ec19..f0ae609845 100644
--- a/actionview/test/actionpack/controller/capture_test.rb
+++ b/actionview/test/actionpack/controller/capture_test.rb
@@ -9,22 +9,22 @@ class CaptureController < ActionController::Base
def content_for
@title = nil
- render :layout => "talk_from_action"
+ render layout: "talk_from_action"
end
def content_for_with_parameter
@title = nil
- render :layout => "talk_from_action"
+ render layout: "talk_from_action"
end
def content_for_concatenated
@title = nil
- render :layout => "talk_from_action"
+ render layout: "talk_from_action"
end
def non_erb_block_content_for
@title = nil
- render :layout => "talk_from_action"
+ render layout: "talk_from_action"
end
def proper_block_detection
diff --git a/actionview/test/actionpack/controller/layout_test.rb b/actionview/test/actionpack/controller/layout_test.rb
index 4eeb58f64f..00147d31f3 100644
--- a/actionview/test/actionpack/controller/layout_test.rb
+++ b/actionview/test/actionpack/controller/layout_test.rb
@@ -92,7 +92,7 @@ end
class StreamingLayoutController < LayoutTest
def render(*args)
options = args.extract_options!
- super(*args, options.merge(:stream => true))
+ super(*args, options.merge(stream: true))
end
end
@@ -119,27 +119,27 @@ end
class PrependsViewPathController < LayoutTest
def hello
prepend_view_path File.dirname(__FILE__) + "/../../fixtures/actionpack/layout_tests/alt/"
- render :layout => "alt"
+ render layout: "alt"
end
end
class OnlyLayoutController < LayoutTest
- layout "item", :only => "hello"
+ layout "item", only: "hello"
end
class ExceptLayoutController < LayoutTest
- layout "item", :except => "goodbye"
+ layout "item", except: "goodbye"
end
class SetsLayoutInRenderController < LayoutTest
def hello
- render :layout => "third_party_template_library"
+ render layout: "third_party_template_library"
end
end
class RendersNoLayoutController < LayoutTest
def hello
- render :layout => false
+ render layout: false
end
end
@@ -241,7 +241,7 @@ end
class LayoutStatusIsRendered < LayoutTest
def hello
- render :status => 401
+ render status: 401
end
end
diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb
index 42326cbe03..9c13bd7f8e 100644
--- a/actionview/test/actionpack/controller/render_test.rb
+++ b/actionview/test/actionpack/controller/render_test.rb
@@ -51,7 +51,7 @@ module Quiz
# Controller
class QuestionsController < ApplicationController
def new
- render :partial => Quiz::Question.new("Namespaced Partial")
+ render partial: Quiz::Question.new("Namespaced Partial")
end
end
end
@@ -64,7 +64,7 @@ module Fun
def hello_world; end
def nested_partial_with_form_builder
- render :partial => ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {})
+ render partial: ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {})
end
end
end
@@ -90,7 +90,7 @@ class TestController < ApplicationController
end
def hello_world_file
- render :file => File.expand_path("../../../fixtures/actionpack/hello", __FILE__), :formats => [:html]
+ render file: File.expand_path("../../../fixtures/actionpack/hello", __FILE__), formats: [:html]
end
# :ported:
@@ -110,7 +110,7 @@ class TestController < ApplicationController
# :ported:
def render_template_in_top_directory
- render :template => "shared"
+ render template: "shared"
end
# :deprecated:
@@ -126,11 +126,11 @@ class TestController < ApplicationController
# :ported:
def render_action_hello_world
- render :action => "hello_world"
+ render action: "hello_world"
end
def render_action_upcased_hello_world
- render :action => "Hello_world"
+ render action: "Hello_world"
end
def render_action_hello_world_as_string
@@ -138,7 +138,7 @@ class TestController < ApplicationController
end
def render_action_hello_world_with_symbol
- render :action => :hello_world
+ render action: :hello_world
end
# :ported:
@@ -149,34 +149,34 @@ class TestController < ApplicationController
# :ported:
def render_text_hello_world_with_layout
@variable_for_layout = ", I am here!"
- render plain: "hello world", :layout => true
+ render plain: "hello world", layout: true
end
def hello_world_with_layout_false
- render :layout => false
+ render layout: false
end
# :ported:
def render_file_with_instance_variables
@secret = "in the sauce"
path = File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_ivar")
- render :file => path
+ render file: path
end
# :ported:
def render_file_not_using_full_path
@secret = "in the sauce"
- render :file => "test/render_file_with_ivar"
+ render file: "test/render_file_with_ivar"
end
def render_file_not_using_full_path_with_dot_in_path
@secret = "in the sauce"
- render :file => "test/dot.directory/render_file_with_ivar"
+ render file: "test/dot.directory/render_file_with_ivar"
end
def render_file_using_pathname
@secret = "in the sauce"
- render :file => Pathname.new(File.dirname(__FILE__)).join("..", "..", "fixtures", "test", "dot.directory", "render_file_with_ivar")
+ render file: Pathname.new(File.dirname(__FILE__)).join("..", "..", "fixtures", "test", "dot.directory", "render_file_with_ivar")
end
def render_file_from_template
@@ -186,33 +186,33 @@ class TestController < ApplicationController
def render_file_with_locals
path = File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_locals")
- render :file => path, :locals => {:secret => "in the sauce"}
+ render file: path, locals: {secret: "in the sauce"}
end
def render_file_as_string_with_locals
path = File.expand_path(File.join(File.dirname(__FILE__), "../../fixtures/test/render_file_with_locals"))
- render file: path, :locals => {:secret => "in the sauce"}
+ render file: path, locals: {secret: "in the sauce"}
end
def accessing_request_in_template
- render :inline => "Hello: <%= request.host %>"
+ render inline: "Hello: <%= request.host %>"
end
def accessing_logger_in_template
- render :inline => "<%= logger.class %>"
+ render inline: "<%= logger.class %>"
end
def accessing_action_name_in_template
- render :inline => "<%= action_name %>"
+ render inline: "<%= action_name %>"
end
def accessing_controller_name_in_template
- render :inline => "<%= controller_name %>"
+ render inline: "<%= controller_name %>"
end
# :ported:
def render_custom_code
- render plain: "hello world", :status => 404
+ render plain: "hello world", status: 404
end
# :ported:
@@ -240,7 +240,7 @@ class TestController < ApplicationController
# setting content type
def render_xml_hello
@name = "David"
- render :template => "test/hello"
+ render template: "test/hello"
end
def render_xml_hello_as_string_template
@@ -249,7 +249,7 @@ class TestController < ApplicationController
end
def render_line_offset
- render :inline => "<% raise %>", :locals => {:foo => "bar"}
+ render inline: "<% raise %>", locals: {foo: "bar"}
end
def heading
@@ -267,44 +267,44 @@ class TestController < ApplicationController
# :ported:
def layout_test
- render :action => "hello_world"
+ render action: "hello_world"
end
# :ported:
def builder_layout_test
@name = nil
- render :action => "hello", :layout => "layouts/builder"
+ render action: "hello", layout: "layouts/builder"
end
# :move: test this in Action View
def builder_partial_test
- render :action => "hello_world_container"
+ render action: "hello_world_container"
end
# :ported:
def partials_list
@test_unchanged = "hello"
@customers = [ Customer.new("david"), Customer.new("mary") ]
- render :action => "list"
+ render action: "list"
end
def partial_only
- render :partial => true
+ render partial: true
end
def hello_in_a_string
@customers = [ Customer.new("david"), Customer.new("mary") ]
- render plain: "How's there? " + render_to_string(:template => "test/list")
+ render plain: "How's there? " + render_to_string(template: "test/list")
end
def accessing_params_in_template
- render :inline => "Hello: <%= params[:name] %>"
+ render inline: "Hello: <%= params[:name] %>"
end
def accessing_local_assigns_in_inline_template
name = params[:local_name]
- render :inline => "<%= 'Goodbye, ' + local_name %>",
- :locals => { :local_name => name }
+ render inline: "<%= 'Goodbye, ' + local_name %>",
+ locals: { local_name: name }
end
def render_implicit_html_template_from_xhr_request
@@ -320,7 +320,7 @@ class TestController < ApplicationController
end
def render_to_string_test
- @foo = render_to_string :inline => "this is a test"
+ @foo = render_to_string inline: "this is a test"
end
def default_render
@@ -333,27 +333,27 @@ class TestController < ApplicationController
end
def render_action_hello_world_as_symbol
- render :action => :hello_world
+ render action: :hello_world
end
def layout_test_with_different_layout
- render :action => "hello_world", :layout => "standard"
+ render action: "hello_world", layout: "standard"
end
def layout_test_with_different_layout_and_string_action
- render "hello_world", :layout => "standard"
+ render "hello_world", layout: "standard"
end
def layout_test_with_different_layout_and_symbol_action
- render :hello_world, :layout => "standard"
+ render :hello_world, layout: "standard"
end
def rendering_without_layout
- render :action => "hello_world", :layout => false
+ render action: "hello_world", layout: false
end
def layout_overriding_layout
- render :action => "hello_world", :layout => "standard"
+ render action: "hello_world", layout: "standard"
end
def rendering_nothing_on_layout
@@ -364,38 +364,38 @@ class TestController < ApplicationController
@before = "i'm before the render"
render_to_string plain: "foo"
@after = "i'm after the render"
- render :template => "test/hello_world"
+ render template: "test/hello_world"
end
def render_to_string_with_exception
- render_to_string :file => "exception that will not be caught - this will certainly not work"
+ render_to_string file: "exception that will not be caught - this will certainly not work"
end
def render_to_string_with_caught_exception
@before = "i'm before the render"
begin
- render_to_string :file => "exception that will be caught- hope my future instance vars still work!"
+ render_to_string file: "exception that will be caught- hope my future instance vars still work!"
rescue
end
@after = "i'm after the render"
- render :template => "test/hello_world"
+ render template: "test/hello_world"
end
def accessing_params_in_template_with_layout
- render :layout => true, :inline => "Hello: <%= params[:name] %>"
+ render layout: true, inline: "Hello: <%= params[:name] %>"
end
# :ported:
def render_with_explicit_template
- render :template => "test/hello_world"
+ render template: "test/hello_world"
end
def render_with_explicit_unescaped_template
- render :template => "test/h*llo_world"
+ render template: "test/h*llo_world"
end
def render_with_explicit_escaped_template
- render :template => "test/hello,world"
+ render template: "test/hello,world"
end
def render_with_explicit_string_template
@@ -404,7 +404,7 @@ class TestController < ApplicationController
# :ported:
def render_with_explicit_template_with_locals
- render :template => "test/render_file_with_locals", :locals => { :secret => "area51" }
+ render template: "test/render_file_with_locals", locals: { secret: "area51" }
end
# :ported:
@@ -414,13 +414,13 @@ class TestController < ApplicationController
end
def double_redirect
- redirect_to :action => "double_render"
- redirect_to :action => "double_render"
+ redirect_to action: "double_render"
+ redirect_to action: "double_render"
end
def render_and_redirect
render plain: "hello"
- redirect_to :action => "double_render"
+ redirect_to action: "double_render"
end
def render_to_string_and_render
@@ -429,22 +429,22 @@ class TestController < ApplicationController
end
def render_to_string_with_inline_and_render
- render_to_string :inline => "<%= 'dlrow olleh'.reverse %>"
- render :template => "test/hello_world"
+ render_to_string inline: "<%= 'dlrow olleh'.reverse %>"
+ render template: "test/hello_world"
end
def rendering_with_conflicting_local_vars
@name = "David"
- render :action => "potential_conflicts"
+ render action: "potential_conflicts"
end
def hello_world_from_rxml_using_action
- render :action => "hello_world_from_rxml", :handlers => [:builder]
+ render action: "hello_world_from_rxml", handlers: [:builder]
end
# :deprecated:
def hello_world_from_rxml_using_template
- render :template => "test/hello_world_from_rxml", :handlers => [:builder]
+ render template: "test/hello_world_from_rxml", handlers: [:builder]
end
def action_talk_to_layout
@@ -462,7 +462,7 @@ class TestController < ApplicationController
end
def yield_content_for
- render :action => "content_for", :layout => "yield"
+ render action: "content_for", layout: "yield"
end
def render_content_type_from_body
@@ -471,70 +471,70 @@ class TestController < ApplicationController
end
def render_using_layout_around_block
- render :action => "using_layout_around_block"
+ render action: "using_layout_around_block"
end
def render_using_layout_around_block_in_main_layout_and_within_content_for_layout
- render :action => "using_layout_around_block", :layout => "layouts/block_with_layout"
+ render action: "using_layout_around_block", layout: "layouts/block_with_layout"
end
def partial_formats_html
- render :partial => "partial", :formats => [:html]
+ render partial: "partial", formats: [:html]
end
def partial
- render :partial => "partial"
+ render partial: "partial"
end
def partial_html_erb
- render :partial => "partial_html_erb"
+ render partial: "partial_html_erb"
end
def render_to_string_with_partial
- @partial_only = render_to_string :partial => "partial_only"
- @partial_with_locals = render_to_string :partial => "customer", :locals => { :customer => Customer.new("david") }
- render :template => "test/hello_world"
+ @partial_only = render_to_string partial: "partial_only"
+ @partial_with_locals = render_to_string partial: "customer", locals: { customer: Customer.new("david") }
+ render template: "test/hello_world"
end
def render_to_string_with_template_and_html_partial
- @text = render_to_string :template => "test/with_partial", :formats => [:text]
- @html = render_to_string :template => "test/with_partial", :formats => [:html]
- render :template => "test/with_html_partial"
+ @text = render_to_string template: "test/with_partial", formats: [:text]
+ @html = render_to_string template: "test/with_partial", formats: [:html]
+ render template: "test/with_html_partial"
end
def render_to_string_and_render_with_different_formats
- @html = render_to_string :template => "test/with_partial", :formats => [:html]
- render :template => "test/with_partial", :formats => [:text]
+ @html = render_to_string template: "test/with_partial", formats: [:html]
+ render template: "test/with_partial", formats: [:text]
end
def render_template_within_a_template_with_other_format
- render :template => "test/with_xml_template",
- :formats => [:html],
- :layout => "with_html_partial"
+ render template: "test/with_xml_template",
+ formats: [:html],
+ layout: "with_html_partial"
end
def partial_with_counter
- render :partial => "counter", :locals => { :counter_counter => 5 }
+ render partial: "counter", locals: { counter_counter: 5 }
end
def partial_with_locals
- render :partial => "customer", :locals => { :customer => Customer.new("david") }
+ render partial: "customer", locals: { customer: Customer.new("david") }
end
def partial_with_form_builder
- render :partial => ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {})
+ render partial: ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {})
end
def partial_with_form_builder_subclass
- render :partial => LabellingFormBuilder.new(:post, nil, view_context, {})
+ render partial: LabellingFormBuilder.new(:post, nil, view_context, {})
end
def partial_collection
- render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ]
+ render partial: "customer", collection: [ Customer.new("david"), Customer.new("mary") ]
end
def partial_collection_with_as
- render :partial => "customer_with_var", :collection => [ Customer.new("david"), Customer.new("mary") ], :as => :customer
+ render partial: "customer_with_var", collection: [ Customer.new("david"), Customer.new("mary") ], as: :customer
end
def partial_collection_with_iteration
@@ -546,42 +546,42 @@ class TestController < ApplicationController
end
def partial_collection_with_counter
- render :partial => "customer_counter", :collection => [ Customer.new("david"), Customer.new("mary") ]
+ render partial: "customer_counter", collection: [ Customer.new("david"), Customer.new("mary") ]
end
def partial_collection_with_as_and_counter
- render :partial => "customer_counter_with_as", :collection => [ Customer.new("david"), Customer.new("mary") ], :as => :client
+ render partial: "customer_counter_with_as", collection: [ Customer.new("david"), Customer.new("mary") ], as: :client
end
def partial_collection_with_locals
- render :partial => "customer_greeting", :collection => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" }
+ render partial: "customer_greeting", collection: [ Customer.new("david"), Customer.new("mary") ], locals: { greeting: "Bonjour" }
end
def partial_collection_with_spacer
- render :partial => "customer", :spacer_template => "partial_only", :collection => [ Customer.new("david"), Customer.new("mary") ]
+ render partial: "customer", spacer_template: "partial_only", collection: [ Customer.new("david"), Customer.new("mary") ]
end
def partial_collection_with_spacer_which_uses_render
- render :partial => "customer", :spacer_template => "partial_with_partial", :collection => [ Customer.new("david"), Customer.new("mary") ]
+ render partial: "customer", spacer_template: "partial_with_partial", collection: [ Customer.new("david"), Customer.new("mary") ]
end
def partial_collection_shorthand_with_locals
- render :partial => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" }
+ render partial: [ Customer.new("david"), Customer.new("mary") ], locals: { greeting: "Bonjour" }
end
def partial_collection_shorthand_with_different_types_of_records
- render :partial => [
+ render partial: [
BadCustomer.new("mark"),
GoodCustomer.new("craig"),
BadCustomer.new("john"),
GoodCustomer.new("zach"),
GoodCustomer.new("brandon"),
BadCustomer.new("dan") ],
- :locals => { :greeting => "Bonjour" }
+ locals: { greeting: "Bonjour" }
end
def empty_partial_collection
- render :partial => "customer", :collection => []
+ render partial: "customer", collection: []
end
def partial_collection_shorthand_with_different_types_of_records_with_counter
@@ -589,15 +589,15 @@ class TestController < ApplicationController
end
def missing_partial
- render :partial => "thisFileIsntHere"
+ render partial: "thisFileIsntHere"
end
def partial_with_hash_object
- render :partial => "hash_object", :object => {:first_name => "Sam"}
+ render partial: "hash_object", object: {first_name: "Sam"}
end
def partial_with_nested_object
- render :partial => "quiz/questions/question", :object => Quiz::Question.new("first")
+ render partial: "quiz/questions/question", object: Quiz::Question.new("first")
end
def partial_with_nested_object_shorthand
@@ -605,24 +605,24 @@ class TestController < ApplicationController
end
def partial_hash_collection
- render :partial => "hash_object", :collection => [ {:first_name => "Pratik"}, {:first_name => "Amy"} ]
+ render partial: "hash_object", collection: [ {first_name: "Pratik"}, {first_name: "Amy"} ]
end
def partial_hash_collection_with_locals
- render :partial => "hash_greeting", :collection => [ {:first_name => "Pratik"}, {:first_name => "Amy"} ], :locals => { :greeting => "Hola" }
+ render partial: "hash_greeting", collection: [ {first_name: "Pratik"}, {first_name: "Amy"} ], locals: { greeting: "Hola" }
end
def partial_with_implicit_local_assignment
@customer = Customer.new("Marcel")
- render :partial => "customer"
+ render partial: "customer"
end
def render_call_to_partial_with_layout
- render :action => "calling_partial_with_layout"
+ render action: "calling_partial_with_layout"
end
def render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout
- render :action => "calling_partial_with_layout", :layout => "layouts/partial_with_layout"
+ render action: "calling_partial_with_layout", layout: "layouts/partial_with_layout"
end
before_action only: :render_with_filters do
@@ -631,7 +631,7 @@ class TestController < ApplicationController
# Ensure that the before filter is executed *before* self.formats is set.
def render_with_filters
- render :action => :formatted_xml_erb
+ render action: :formatted_xml_erb
end
private
diff --git a/actionview/test/actionpack/controller/view_paths_test.rb b/actionview/test/actionpack/controller/view_paths_test.rb
index cdfaab5979..0ce515bba5 100644
--- a/actionview/test/actionpack/controller/view_paths_test.rb
+++ b/actionview/test/actionpack/controller/view_paths_test.rb
@@ -7,7 +7,7 @@ class ViewLoadPathsTest < ActionController::TestCase
before_action :add_view_path, only: :hello_world_at_request_time
def hello_world() end
- def hello_world_at_request_time() render(:action => "hello_world") end
+ def hello_world_at_request_time() render(action: "hello_world") end
private
def add_view_path
@@ -18,7 +18,7 @@ class ViewLoadPathsTest < ActionController::TestCase
module Test
class SubController < ActionController::Base
layout "test/sub"
- def hello_world; render(:template => "test/hello_world"); end
+ def hello_world; render(template: "test/hello_world"); end
end
end
@@ -132,8 +132,8 @@ class ViewLoadPathsTest < ActionController::TestCase
template.identifier,
template.handler,
{
- :virtual_path => template.virtual_path,
- :format => template.formats
+ virtual_path: template.virtual_path,
+ format: template.formats
}
)
end