class TestController
Public Instance Methods
accessing_action_name_in_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 173 def accessing_action_name_in_template render inline: "<%= action_name %>" end
accessing_controller_name_in_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 177 def accessing_controller_name_in_template render inline: "<%= controller_name %>" end
accessing_local_assigns_in_inline_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 272 def accessing_local_assigns_in_inline_template name = params[:local_name] render inline: "<%= 'Goodbye, ' + local_name %>", locals: { local_name: name } end
accessing_logger_in_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 169 def accessing_logger_in_template render inline: "<%= logger.class %>" end
accessing_params_in_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 268 def accessing_params_in_template render inline: "Hello: <%= params[:name] %>" end
accessing_params_in_template_with_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 352 def accessing_params_in_template_with_layout render layout: true, inline: "Hello: <%= params[:name] %>" end
accessing_request_in_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 165 def accessing_request_in_template render inline: "Hello: <%= request.host %>" end
action_talk_to_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 418 def action_talk_to_layout # Action template sets variable that's picked up by layout end
blank_response()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 232 def blank_response render plain: " " end
builder_layout_test()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 242 def builder_layout_test @name = nil render action: "hello", layout: "layouts/builder" end
builder_partial_test()
click to toggle source
:move: test this in Action View
# File actionview/test/actionpack/controller/render_test.rb, line 248 def builder_partial_test render action: "hello_world_container" end
conditional_hello()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 75 def conditional_hello if stale?(last_modified: Time.now.utc.beginning_of_day, etag: [:foo, 123]) render action: "hello_world" end end
conditional_hello_with_bangs()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 165 def conditional_hello_with_bangs render action: "hello_world" end
conditional_hello_with_cache_control_headers()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 159 def conditional_hello_with_cache_control_headers response.headers["Cache-Control"] = "no-transform" expires_now render action: "hello_world" end
conditional_hello_with_collection_of_records()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 113 def conditional_hello_with_collection_of_records ts = Time.now.utc.beginning_of_day record = Struct.new(:updated_at, :cache_key).new(ts, "foo/123") old_record = Struct.new(:updated_at, :cache_key).new(ts - 1.day, "bar/123") if stale?(Collection.new([record, old_record])) render action: "hello_world" end end
conditional_hello_with_expires_in()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 124 def conditional_hello_with_expires_in expires_in 60.1.seconds render action: "hello_world" end
conditional_hello_with_expires_in_with_must_revalidate()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 134 def conditional_hello_with_expires_in_with_must_revalidate expires_in 1.minute, must_revalidate: true render action: "hello_world" end
conditional_hello_with_expires_in_with_public()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 129 def conditional_hello_with_expires_in_with_public expires_in 1.minute, public: true render action: "hello_world" end
conditional_hello_with_expires_in_with_public_and_must_revalidate()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 139 def conditional_hello_with_expires_in_with_public_and_must_revalidate expires_in 1.minute, public: true, must_revalidate: true render action: "hello_world" end
conditional_hello_with_expires_in_with_public_with_more_keys()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 144 def conditional_hello_with_expires_in_with_public_with_more_keys expires_in 1.minute, :public => true, "s-maxage" => 5.hours render action: "hello_world" end
conditional_hello_with_expires_in_with_public_with_more_keys_old_syntax()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 149 def conditional_hello_with_expires_in_with_public_with_more_keys_old_syntax expires_in 1.minute, :public => true, :private => nil, "s-maxage" => 5.hours render action: "hello_world" end
conditional_hello_with_expires_now()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 154 def conditional_hello_with_expires_now expires_now render action: "hello_world" end
conditional_hello_with_record()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 81 def conditional_hello_with_record record = Struct.new(:updated_at, :cache_key).new(Time.now.utc.beginning_of_day, "foo/123") if stale?(record) render action: "hello_world" end end
default_render()
click to toggle source
Calls superclass method
# File actionview/test/actionpack/controller/render_test.rb, line 294 def default_render @alternate_default_render ||= nil if @alternate_default_render @alternate_default_render.call else super end end
double_redirect()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 384 def double_redirect redirect_to action: "double_render" redirect_to action: "double_render" end
double_render()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 379 def double_render render plain: "hello" render plain: "world" end
dynamic_render()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 89 def dynamic_render render params[:id] # => String, AC::Params end
dynamic_render_permit()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 93 def dynamic_render_permit render params[:id].permit(:file) end
dynamic_render_with_file()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 97 def dynamic_render_with_file # This is extremely bad, but should be possible to do. file = params[:id] # => String, AC::Params render file: file end
empty_partial_collection()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 551 def empty_partial_collection render partial: "customer", collection: [] end
formatted_html_erb()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 284 def formatted_html_erb end
formatted_xml_erb()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 287 def formatted_xml_erb end
greeting()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 227 def greeting # let's just rely on the template end
head_and_return()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 218 def head_and_return head(:ok) && return raise "should not reach this line" end
head_created()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 174 def head_created head :created end
head_created_with_application_json_content_type()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 178 def head_created_with_application_json_content_type head :created, content_type: "application/json" end
head_ok_with_image_png_content_type()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 182 def head_ok_with_image_png_content_type head :ok, content_type: "image/png" end
head_with_custom_header()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 206 def head_with_custom_header head :ok, x_custom_header: "something" end
head_with_integer_status()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 198 def head_with_integer_status head params[:status].to_i end
head_with_location_header()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 186 def head_with_location_header head :ok, location: "/foo" end
head_with_location_object()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 190 def head_with_location_object head :ok, location: Customer.new("david", 1) end
head_with_no_content()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 223 def head_with_no_content # Fill in the headers with dummy data to make # sure they get removed during the testing response.headers["Content-Type"] = "dummy" response.headers["Content-Length"] = 42 head 204 end
head_with_status_code_first()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 214 def head_with_status_code_first head :forbidden, x_custom_header: "something" end
head_with_string_status()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 202 def head_with_string_status head params[:status] end
head_with_symbolic_status()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 194 def head_with_symbolic_status head params[:status].intern end
head_with_www_authenticate_header()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 210 def head_with_www_authenticate_header head :ok, "WWW-Authenticate" => "something" end
heading()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 223 def heading head :ok end
hello_in_a_string()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 263 def hello_in_a_string @customers = [ Customer.new("david"), Customer.new("mary") ] render plain: "How's there? " + render_to_string(template: "test/list") end
hello_world()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 72 def hello_world end
hello_world_file()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 60 def hello_world_file render file: File.expand_path("../../fixtures/actionpack/hello", __dir__), formats: [:html] end
hello_world_from_rxml_using_action()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 409 def hello_world_from_rxml_using_action render action: "hello_world_from_rxml", handlers: [:builder] end
hello_world_from_rxml_using_template()
click to toggle source
:deprecated:
# File actionview/test/actionpack/controller/render_test.rb, line 414 def hello_world_from_rxml_using_template render template: "test/hello_world_from_rxml", handlers: [:builder] end
hello_world_with_layout_false()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 123 def hello_world_with_layout_false render layout: false end
layout_overriding_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 323 def layout_overriding_layout render action: "hello_world", layout: "standard" end
layout_test()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 237 def layout_test render action: "hello_world" end
layout_test_with_different_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 307 def layout_test_with_different_layout render action: "hello_world", layout: "standard" end
layout_test_with_different_layout_and_string_action()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 311 def layout_test_with_different_layout_and_string_action render "hello_world", layout: "standard" end
layout_test_with_different_layout_and_symbol_action()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 315 def layout_test_with_different_layout_and_symbol_action render :hello_world, layout: "standard" end
missing_partial()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 559 def missing_partial render partial: "thisFileIsntHere" end
partial()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 453 def partial render partial: "partial" end
partial_collection()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 500 def partial_collection render partial: "customer", collection: [ Customer.new("david"), Customer.new("mary") ] end
partial_collection_shorthand_with_different_types_of_records()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 540 def partial_collection_shorthand_with_different_types_of_records render partial: [ BadCustomer.new("mark"), GoodCustomer.new("craig"), BadCustomer.new("john"), GoodCustomer.new("zach"), GoodCustomer.new("brandon"), BadCustomer.new("dan") ], locals: { greeting: "Bonjour" } end
partial_collection_shorthand_with_different_types_of_records_with_counter()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 555 def partial_collection_shorthand_with_different_types_of_records_with_counter partial_collection_shorthand_with_different_types_of_records end
partial_collection_shorthand_with_locals()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 536 def partial_collection_shorthand_with_locals render partial: [ Customer.new("david"), Customer.new("mary") ], locals: { greeting: "Bonjour" } end
partial_collection_with_as()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 504 def partial_collection_with_as render partial: "customer_with_var", collection: [ Customer.new("david"), Customer.new("mary") ], as: :customer end
partial_collection_with_as_and_counter()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 520 def partial_collection_with_as_and_counter render partial: "customer_counter_with_as", collection: [ Customer.new("david"), Customer.new("mary") ], as: :client end
partial_collection_with_as_and_iteration()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 512 def partial_collection_with_as_and_iteration render partial: "customer_iteration_with_as", collection: [ Customer.new("david"), Customer.new("mary"), Customer.new("christine") ], as: :client end
partial_collection_with_counter()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 516 def partial_collection_with_counter render partial: "customer_counter", collection: [ Customer.new("david"), Customer.new("mary") ] end
partial_collection_with_iteration()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 508 def partial_collection_with_iteration render partial: "customer_iteration", collection: [ Customer.new("david"), Customer.new("mary"), Customer.new("christine") ] end
partial_collection_with_locals()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 524 def partial_collection_with_locals render partial: "customer_greeting", collection: [ Customer.new("david"), Customer.new("mary") ], locals: { greeting: "Bonjour" } end
partial_collection_with_spacer()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 528 def partial_collection_with_spacer render partial: "customer", spacer_template: "partial_only", collection: [ Customer.new("david"), Customer.new("mary") ] end
partial_collection_with_spacer_which_uses_render()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 532 def partial_collection_with_spacer_which_uses_render render partial: "customer", spacer_template: "partial_with_partial", collection: [ Customer.new("david"), Customer.new("mary") ] end
partial_formats_html()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 449 def partial_formats_html render partial: "partial", formats: [:html] end
partial_hash_collection()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 575 def partial_hash_collection render partial: "hash_object", collection: [ { first_name: "Pratik" }, { first_name: "Amy" } ] end
partial_hash_collection_with_locals()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 579 def partial_hash_collection_with_locals render partial: "hash_greeting", collection: [ { first_name: "Pratik" }, { first_name: "Amy" } ], locals: { greeting: "Hola" } end
partial_html_erb()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 457 def partial_html_erb render partial: "partial_html_erb" end
partial_only()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 259 def partial_only render partial: true end
partial_with_counter()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 484 def partial_with_counter render partial: "counter", locals: { counter_counter: 5 } end
partial_with_form_builder()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 492 def partial_with_form_builder render partial: ActionView::Helpers::FormBuilder.new(:post, nil, view_context, {}) end
partial_with_form_builder_subclass()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 496 def partial_with_form_builder_subclass render partial: LabellingFormBuilder.new(:post, nil, view_context, {}) end
partial_with_hash_object()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 563 def partial_with_hash_object render partial: "hash_object", object: { first_name: "Sam" } end
partial_with_implicit_local_assignment()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 583 def partial_with_implicit_local_assignment @customer = Customer.new("Marcel") render partial: "customer" end
partial_with_locals()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 488 def partial_with_locals render partial: "customer", locals: { customer: Customer.new("david") } end
partial_with_nested_object()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 567 def partial_with_nested_object render partial: "quiz/questions/question", object: Quiz::Question.new("first") end
partial_with_nested_object_shorthand()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 571 def partial_with_nested_object_shorthand render Quiz::Question.new("first") end
partials_list()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 253 def partials_list @test_unchanged = "hello" @customers = [ Customer.new("david"), Customer.new("mary") ] render action: "list" end
render_action_hello_world()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 96 def render_action_hello_world render action: "hello_world" end
render_action_hello_world_as_string()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 104 def render_action_hello_world_as_string render "hello_world" end
render_action_hello_world_as_symbol()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 303 def render_action_hello_world_as_symbol render action: :hello_world end
render_action_hello_world_with_symbol()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 108 def render_action_hello_world_with_symbol render action: :hello_world end
render_action_upcased_hello_world()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 100 def render_action_upcased_hello_world render action: "Hello_world" end
render_and_redirect()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 389 def render_and_redirect render plain: "hello" redirect_to action: "double_render" end
render_call_to_partial_with_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 588 def render_call_to_partial_with_layout render action: "calling_partial_with_layout" end
render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 592 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" end
render_content_type_from_body()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 436 def render_content_type_from_body response.content_type = Mime[:rss] render body: "hello world!" end
render_custom_code()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 182 def render_custom_code render plain: "hello world", status: 404 end
render_file_as_string_with_locals()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 160 def render_file_as_string_with_locals path = File.expand_path("../../fixtures/test/render_file_with_locals", __dir__) render file: path, locals: { secret: "in the sauce" } end
render_file_from_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 150 def render_file_from_template @secret = "in the sauce" @path = File.expand_path("../../fixtures/test/render_file_with_ivar", __dir__) end
render_file_not_using_full_path()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 135 def render_file_not_using_full_path @secret = "in the sauce" render file: "test/render_file_with_ivar" end
render_file_not_using_full_path_with_dot_in_path()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 140 def render_file_not_using_full_path_with_dot_in_path @secret = "in the sauce" render file: "test/dot.directory/render_file_with_ivar" end
render_file_using_pathname()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 145 def render_file_using_pathname @secret = "in the sauce" render file: Pathname.new(__dir__).join("..", "..", "fixtures", "test", "dot.directory", "render_file_with_ivar") end
render_file_with_instance_variables()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 128 def render_file_with_instance_variables @secret = "in the sauce" path = File.expand_path("../../fixtures/test/render_file_with_ivar", __dir__) render file: path end
render_file_with_locals()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 155 def render_file_with_locals path = File.expand_path("../../fixtures/test/render_file_with_locals", __dir__) render file: path, locals: { secret: "in the sauce" } end
render_hello_world()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 65 def render_hello_world render "test/hello_world" end
render_hello_world_from_variable()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 90 def render_hello_world_from_variable @person = "david" render plain: "hello #{@person}" end
render_hello_world_with_forward_slash()
click to toggle source
:ported: compatibility
# File actionview/test/actionpack/controller/render_test.rb, line 75 def render_hello_world_with_forward_slash render "/test/hello_world" end
render_hello_world_with_last_modified_set()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 69 def render_hello_world_with_last_modified_set response.last_modified = Date.new(2008, 10, 10).to_time render "test/hello_world" end
render_implicit_html_template_from_xhr_request()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 278 def render_implicit_html_template_from_xhr_request end
render_implicit_js_template_without_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 281 def render_implicit_js_template_without_layout end
render_line_offset()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 219 def render_line_offset render inline: "<% raise %>", locals: { foo: "bar" } end
render_nothing_with_appendix()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 201 def render_nothing_with_appendix render plain: "appended" end
render_template_in_top_directory()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 80 def render_template_in_top_directory render template: "shared" end
render_template_in_top_directory_with_slash()
click to toggle source
:deprecated:
# File actionview/test/actionpack/controller/render_test.rb, line 85 def render_template_in_top_directory_with_slash render "/shared" end
render_template_within_a_template_with_other_format()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 478 def render_template_within_a_template_with_other_format render template: "test/with_xml_template", formats: [:html], layout: "with_html_partial" end
render_text_hello_world()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 113 def render_text_hello_world render plain: "hello world" end
render_text_hello_world_with_layout()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 118 def render_text_hello_world_with_layout @variable_for_layout = ", I am here!" render plain: "hello world", layout: true end
render_text_with_assigns()
click to toggle source
:addressed:
# File actionview/test/actionpack/controller/render_test.rb, line 423 def render_text_with_assigns @hello = "world" render plain: "foo" end
render_text_with_false()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 192 def render_text_with_false render plain: false end
render_text_with_nil()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 187 def render_text_with_nil render plain: nil end
render_text_with_resource()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 196 def render_text_with_resource render plain: Customer.new("David") end
render_to_string_and_render()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 394 def render_to_string_and_render @stuff = render_to_string plain: "here is some cached stuff" render plain: "Hi web users! #{@stuff}" end
render_to_string_and_render_with_different_formats()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 473 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] end
render_to_string_test()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 290 def render_to_string_test @foo = render_to_string inline: "this is a test" end
render_to_string_with_assigns()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 331 def render_to_string_with_assigns @before = "i'm before the render" render_to_string plain: "foo" @after = "i'm after the render" render template: "test/hello_world" end
render_to_string_with_caught_exception()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 342 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!" rescue end @after = "i'm after the render" render template: "test/hello_world" end
render_to_string_with_exception()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 338 def render_to_string_with_exception render_to_string file: "exception that will not be caught - this will certainly not work" end
render_to_string_with_inline_and_render()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 399 def render_to_string_with_inline_and_render render_to_string inline: "<%= 'dlrow olleh'.reverse %>" render template: "test/hello_world" end
render_to_string_with_partial()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 461 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" end
render_to_string_with_template_and_html_partial()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 467 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" end
render_using_layout_around_block()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 441 def render_using_layout_around_block render action: "using_layout_around_block" end
render_using_layout_around_block_in_main_layout_and_within_content_for_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 445 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" end
render_with_assigns_option()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 428 def render_with_assigns_option render inline: "<%= @hello %>", assigns: { hello: "world" } end
render_with_explicit_escaped_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 365 def render_with_explicit_escaped_template render template: "test/hello,world" end
render_with_explicit_string_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 369 def render_with_explicit_string_template render "test/hello_world" end
render_with_explicit_template()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 357 def render_with_explicit_template render template: "test/hello_world" end
render_with_explicit_template_with_locals()
click to toggle source
:ported:
# File actionview/test/actionpack/controller/render_test.rb, line 374 def render_with_explicit_template_with_locals render template: "test/render_file_with_locals", locals: { secret: "area51" } end
render_with_explicit_unescaped_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 361 def render_with_explicit_unescaped_template render template: "test/h*llo_world" end
render_with_filters()
click to toggle source
Ensure that the before filter is executed before self.formats is set.
# File actionview/test/actionpack/controller/render_test.rb, line 601 def render_with_filters render action: :formatted_xml_erb end
render_xml_hello()
click to toggle source
This test is testing 3 things:
render :file in AV :ported: render :template in AC :ported: setting content type
# File actionview/test/actionpack/controller/render_test.rb, line 209 def render_xml_hello @name = "David" render template: "test/hello" end
render_xml_hello_as_string_template()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 214 def render_xml_hello_as_string_template @name = "David" render "test/hello" end
rendering_nothing_on_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 327 def rendering_nothing_on_layout head :ok end
rendering_with_conflicting_local_vars()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 404 def rendering_with_conflicting_local_vars @name = "David" render action: "potential_conflicts" end
rendering_without_layout()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 319 def rendering_without_layout render action: "hello_world", layout: false end
send_mail()
click to toggle source
# File actionmailer/test/i18n_with_controller_test.rb, line 21 def send_mail email = I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver_now render plain: "Mail sent - Subject: #{email.subject}" end
yield_content_for()
click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 432 def yield_content_for render action: "content_for", layout: "yield" end
Private Instance Methods
determine_layout()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 238 def determine_layout case action_name when "hello_world", "layout_test", "rendering_without_layout", "rendering_nothing_on_layout", "render_text_hello_world", "render_text_hello_world_with_layout", "hello_world_with_layout_false", "partial_only", "accessing_params_in_template", "accessing_params_in_template_with_layout", "render_with_explicit_template", "render_with_explicit_string_template", "update_page", "update_page_with_instance_variables" "layouts/standard" when "action_talk_to_layout", "layout_overriding_layout" "layouts/talk_from_action" when "render_implicit_html_template_from_xhr_request" (request.xhr? ? "layouts/xhr" : "layouts/standard") end end
name()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 65 def name nil end
set_variable_for_layout()
click to toggle source
# File actionpack/test/controller/render_test.rb, line 234 def set_variable_for_layout @variable_for_layout = nil end