class RenderTest

Public Instance Methods

setup() click to toggle source
Calls superclass method
# File actionview/test/actionpack/controller/render_test.rb, line 635
def setup
  # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get
  # a more accurate simulation of what happens in "real life".
  super
  @controller.logger      = ActiveSupport::Logger.new(nil)
  ActionView::Base.logger = ActiveSupport::Logger.new(nil)

  @request.host = "www.nextangle.com"
end
teardown() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 645
def teardown
  ActionView::Base.logger = nil
end
test_access_to_action_name_in_view() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 847
def test_access_to_action_name_in_view
  get :accessing_action_name_in_template
  assert_equal "accessing_action_name_in_template", @response.body
end
test_access_to_controller_name_in_view() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 853
def test_access_to_controller_name_in_view
  get :accessing_controller_name_in_template
  assert_equal "test", @response.body # name is explicitly set in the controller.
end
test_access_to_logger_in_view() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 841
def test_access_to_logger_in_view
  get :accessing_logger_in_template
  assert_equal "ActiveSupport::Logger", @response.body
end
test_access_to_request_in_view() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 836
def test_access_to_request_in_view
  get :accessing_request_in_template
  assert_equal "Hello: www.nextangle.com", @response.body
end
test_accessing_local_assigns_in_inline_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 927
def test_accessing_local_assigns_in_inline_template
  get :accessing_local_assigns_in_inline_template, params: { local_name: "Local David" }
  assert_equal "Goodbye, Local David", @response.body
  assert_equal "text/html", @response.content_type
end
test_accessing_params_in_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 922
def test_accessing_params_in_template
  get :accessing_params_in_template, params: { name: "David" }
  assert_equal "Hello: David", @response.body
end
test_accessing_params_in_template_with_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1011
def test_accessing_params_in_template_with_layout
  get :accessing_params_in_template_with_layout, params: { name: "David" }
  assert_equal "<html>Hello: David</html>", @response.body
end
test_action_talk_to_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1061
def test_action_talk_to_layout
  get :action_talk_to_layout
  assert_equal "<title>Talking to the layout</title>\nAction was here!", @response.body
end
test_attempt_to_access_object_method() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 826
def test_attempt_to_access_object_method
  assert_raise(AbstractController::ActionNotFound) { get :clone }
end
test_bad_render_to_string_still_throws_exception() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1001
def test_bad_render_to_string_still_throws_exception
  assert_raise(ActionView::MissingTemplate) { get :render_to_string_with_exception }
end
test_do_with_render_action_and_layout_false() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 740
def test_do_with_render_action_and_layout_false
  get :hello_world_with_layout_false
  assert_equal "Hello world!", @response.body
end
test_do_with_render_text_and_layout() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 734
def test_do_with_render_text_and_layout
  get :render_text_hello_world_with_layout
  assert_equal "{{hello world, I am here!}}\n", @response.body
end
test_double_redirect() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1042
def test_double_redirect
  assert_raise(AbstractController::DoubleRenderError) { get :double_redirect }
end
test_double_render() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 1038
def test_double_render
  assert_raise(AbstractController::DoubleRenderError) { get :double_render }
end
test_empty_partial_collection() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1249
def test_empty_partial_collection
  get :empty_partial_collection
  assert_equal " ", @response.body
end
test_hash_partial_collection() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1269
def test_hash_partial_collection
  get :partial_hash_collection
  assert_equal "Pratik\nkitarP\nAmy\nymA\n", @response.body
end
test_layout_overriding_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 985
def test_layout_overriding_layout
  get :layout_overriding_layout
  assert_no_match %r{<title>}, @response.body
end
test_layout_rendering() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 885
def test_layout_rendering
  get :layout_test
  assert_equal "<html>Hello world!</html>", @response.body
end
test_layout_test_with_different_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 965
def test_layout_test_with_different_layout
  get :layout_test_with_different_layout
  assert_equal "<html>Hello world!</html>", @response.body
end
test_layout_test_with_different_layout_and_string_action() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 970
def test_layout_test_with_different_layout_and_string_action
  get :layout_test_with_different_layout_and_string_action
  assert_equal "<html>Hello world!</html>", @response.body
end
test_layout_test_with_different_layout_and_symbol_action() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 975
def test_layout_test_with_different_layout_and_symbol_action
  get :layout_test_with_different_layout_and_symbol_action
  assert_equal "<html>Hello world!</html>", @response.body
end
test_line_offset() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 669
def test_line_offset
  exc = assert_raises ActionView::Template::Error do
    get :render_line_offset
  end
  line = exc.backtrace.first
  assert(line =~ %r{:(\d+):})
  assert_equal "1", $1,
    "The line offset is wrong, perhaps the wrong exception has been raised, exception was: #{exc.inspect}"
end
test_namespaced_object_partial() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1188
def test_namespaced_object_partial
  @controller = Quiz::QuestionsController.new
  get :new
  assert_equal "Namespaced Partial", @response.body
end
test_nested_partial_with_form_builder() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1182
def test_nested_partial_with_form_builder
  @controller = Fun::GamesController.new
  get :nested_partial_with_form_builder
  assert_equal "<label for=\"post_title\">Title</label>\n", @response.body
end
test_nested_rendering() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 916
def test_nested_rendering
  @controller = Fun::GamesController.new
  get :hello_world
  assert_equal "Living in a nested world", @response.body
end
test_overwriting_rendering_relative_file_with_extension() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1088
def test_overwriting_rendering_relative_file_with_extension
  get :hello_world_from_rxml_using_template
  assert_equal "<html>\n  <p>Hello</p>\n</html>\n", @response.body

  get :hello_world_from_rxml_using_action
  assert_equal "<html>\n  <p>Hello</p>\n</html>\n", @response.body
end
test_partial_collection() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1194
def test_partial_collection
  get :partial_collection
  assert_equal "Hello: davidHello: mary", @response.body
end
test_partial_collection_shorthand_with_different_types_of_records() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1244
def test_partial_collection_shorthand_with_different_types_of_records
  get :partial_collection_shorthand_with_different_types_of_records
  assert_equal "Bonjour bad customer: mark0Bonjour good customer: craig1Bonjour bad customer: john2Bonjour good customer: zach3Bonjour good customer: brandon4Bonjour bad customer: dan5", @response.body
end
test_partial_collection_shorthand_with_locals() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1239
def test_partial_collection_shorthand_with_locals
  get :partial_collection_shorthand_with_locals
  assert_equal "Bonjour: davidBonjour: mary", @response.body
end
test_partial_collection_with_as() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1199
def test_partial_collection_with_as
  get :partial_collection_with_as
  assert_equal "david david davidmary mary mary", @response.body
end
test_partial_collection_with_as_and_counter() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1219
def test_partial_collection_with_as_and_counter
  get :partial_collection_with_as_and_counter
  assert_equal "david0mary1", @response.body
end
test_partial_collection_with_as_and_iteration() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1209
def test_partial_collection_with_as_and_iteration
  get :partial_collection_with_as_and_iteration
  assert_equal "3-0: david-first3-1: mary3-2: christine-last", @response.body
end
test_partial_collection_with_counter() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1214
def test_partial_collection_with_counter
  get :partial_collection_with_counter
  assert_equal "david0mary1", @response.body
end
test_partial_collection_with_iteration() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1204
def test_partial_collection_with_iteration
  get :partial_collection_with_iteration
  assert_equal "3-0: david-first3-1: mary3-2: christine-last", @response.body
end
test_partial_collection_with_locals() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1224
def test_partial_collection_with_locals
  get :partial_collection_with_locals
  assert_equal "Bonjour: davidBonjour: mary", @response.body
end
test_partial_collection_with_spacer() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1229
def test_partial_collection_with_spacer
  get :partial_collection_with_spacer
  assert_equal "Hello: davidonly partialHello: mary", @response.body
end
test_partial_collection_with_spacer_which_uses_render() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1234
def test_partial_collection_with_spacer_which_uses_render
  get :partial_collection_with_spacer_which_uses_render
  assert_equal "Hello: davidpartial html\npartial with partial\nHello: mary", @response.body
end
test_partial_hash_collection_with_locals() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1274
def test_partial_hash_collection_with_locals
  get :partial_hash_collection_with_locals
  assert_equal "Hola: PratikHola: Amy", @response.body
end
test_partial_only() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1106
def test_partial_only
  get :partial_only
  assert_equal "only partial", @response.body
  assert_equal "text/html", @response.content_type
end
test_partial_with_counter() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1162
def test_partial_with_counter
  get :partial_with_counter
  assert_equal "5", @response.body
end
test_partial_with_form_builder() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1172
def test_partial_with_form_builder
  get :partial_with_form_builder
  assert_equal "<label for=\"post_title\">Title</label>\n", @response.body
end
test_partial_with_form_builder_subclass() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1177
def test_partial_with_form_builder_subclass
  get :partial_with_form_builder_subclass
  assert_equal "<label for=\"post_title\">Title</label>\n", @response.body
end
test_partial_with_hash_object() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1254
def test_partial_with_hash_object
  get :partial_with_hash_object
  assert_equal "Sam\nmaS\n", @response.body
end
test_partial_with_locals() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1167
def test_partial_with_locals
  get :partial_with_locals
  assert_equal "Hello: david", @response.body
end
test_partial_with_nested_object() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1259
def test_partial_with_nested_object
  get :partial_with_nested_object
  assert_equal "first", @response.body
end
test_partial_with_nested_object_shorthand() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1264
def test_partial_with_nested_object_shorthand
  get :partial_with_nested_object_shorthand
  assert_equal "first", @response.body
end
test_partials_list() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 895
def test_partials_list
  get :partials_list
  assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body
end
test_private_methods() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 831
def test_private_methods
  assert_raise(AbstractController::ActionNotFound) { get :determine_layout }
end
test_render() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 664
def test_render
  get :render_hello_world
  assert_equal "Hello world!", @response.body
end
test_render_action() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 704
def test_render_action
  get :render_action_hello_world
  assert_equal "Hello world!", @response.body
end
test_render_action_hello_world_as_string() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 716
def test_render_action_hello_world_as_string
  get :render_action_hello_world_as_string
  assert_equal "Hello world!", @response.body
end
test_render_action_upcased() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 709
def test_render_action_upcased
  assert_raise ActionView::MissingTemplate do
    get :render_action_upcased_hello_world
  end
end
test_render_action_with_symbol() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 722
def test_render_action_with_symbol
  get :render_action_hello_world_with_symbol
  assert_equal "Hello world!", @response.body
end
test_render_and_redirect() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1046
def test_render_and_redirect
  assert_raise(AbstractController::DoubleRenderError) { get :render_and_redirect }
end
test_render_call_to_partial_with_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1285
def test_render_call_to_partial_with_layout
  get :render_call_to_partial_with_layout
  assert_equal "Before (David)\nInside from partial (David)\nAfter", @response.body
end
test_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 1290
def test_render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout
  get :render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout
  assert_equal "Before (Anthony)\nInside from partial (Anthony)\nAfter\nBefore (David)\nInside from partial (David)\nAfter\nBefore (Ramm)\nInside from partial (Ramm)\nAfter", @response.body
end
test_render_custom_code() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 793
def test_render_custom_code
  get :render_custom_code
  assert_response 404
  assert_response :missing
  assert_equal "hello world", @response.body
end
test_render_file() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 751
def test_render_file
  get :hello_world_file
  assert_equal "Hello world!", @response.body
end
test_render_file_as_string_with_locals() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 781
def test_render_file_as_string_with_locals
  get :render_file_as_string_with_locals
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_file_from_template() click to toggle source

:assessed:

# File actionview/test/actionpack/controller/render_test.rb, line 787
def test_render_file_from_template
  get :render_file_from_template
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_file_not_using_full_path() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 757
def test_render_file_not_using_full_path
  get :render_file_not_using_full_path
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_file_not_using_full_path_with_dot_in_path() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 763
def test_render_file_not_using_full_path_with_dot_in_path
  get :render_file_not_using_full_path_with_dot_in_path
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_file_using_pathname() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 769
def test_render_file_using_pathname
  get :render_file_using_pathname
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_file_with_instance_variables() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 746
def test_render_file_with_instance_variables
  get :render_file_with_instance_variables
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_file_with_locals() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 775
def test_render_file_with_locals
  get :render_file_with_locals
  assert_equal "The secret is in the sauce\n", @response.body
end
test_render_from_variable() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 698
def test_render_from_variable
  get :render_hello_world_from_variable
  assert_equal "hello david", @response.body
end
test_render_html_formatted_partial_even_with_other_mime_time_in_accept() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1118
def test_render_html_formatted_partial_even_with_other_mime_time_in_accept
  @request.accept = "text/javascript, text/html"

  get :partial_html_erb

  assert_equal "partial.html.erb", @response.body.strip
  assert_equal "text/html", @response.content_type
end
test_render_in_top_directory() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 686
def test_render_in_top_directory
  get :render_template_in_top_directory
  assert_equal "Elastica", @response.body
end
test_render_in_top_directory_with_slash() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 692
def test_render_in_top_directory_with_slash
  get :render_template_in_top_directory_with_slash
  assert_equal "Elastica", @response.body
end
test_render_missing_partial_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1279
def test_render_missing_partial_template
  assert_raise(ActionView::MissingTemplate) do
    get :missing_partial
  end
end
test_render_nothing_with_appendix() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 814
def test_render_nothing_with_appendix
  get :render_nothing_with_appendix
  assert_response 200
  assert_equal "appended", @response.body
end
test_render_template_within_a_template_with_other_format() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1155
def test_render_template_within_a_template_with_other_format
  get :render_template_within_a_template_with_other_format
  expected = "only html partial<p>This is grand!</p>"
  assert_equal expected, @response.body.strip
  assert_equal "text/html", @response.content_type
end
test_render_text() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 728
def test_render_text
  get :render_text_hello_world
  assert_equal "hello world", @response.body
end
test_render_text_with_assigns() click to toggle source

:addressed:

# File actionview/test/actionpack/controller/render_test.rb, line 1067
def test_render_text_with_assigns
  get :render_text_with_assigns
  assert_equal "world", @controller.instance_variable_get(:@hello)
end
test_render_text_with_assigns_option() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1072
def test_render_text_with_assigns_option
  get :render_with_assigns_option
  assert_equal "world", response.body
end
test_render_text_with_false() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 808
def test_render_text_with_false
  get :render_text_with_false
  assert_equal "false", @response.body
end
test_render_text_with_nil() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 801
def test_render_text_with_nil
  get :render_text_with_nil
  assert_response 200
  assert_equal "", @response.body
end
test_render_text_with_resource() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 820
def test_render_text_with_resource
  get :render_text_with_resource
  assert_equal 'name: "David"', @response.body
end
test_render_to_string() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 900
def test_render_to_string
  get :hello_in_a_string
  assert_equal "How's there? goodbyeHello: davidHello: marygoodbye\n", @response.body
end
test_render_to_string_and_render() click to toggle source

specify the one exception to double render rule - render_to_string followed by render

# File actionview/test/actionpack/controller/render_test.rb, line 1051
def test_render_to_string_and_render
  get :render_to_string_and_render
  assert_equal("Hi web users! here is some cached stuff", @response.body)
end
test_render_to_string_and_render_with_different_formats() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1148
def test_render_to_string_and_render_with_different_formats
  get :render_to_string_and_render_with_different_formats
  assert_equal "<strong>only partial</strong>\n", @controller.instance_variable_get(:@html)
  assert_equal "**only partial**\n", @response.body
  assert_equal "text/plain", @response.content_type
end
test_render_to_string_doesnt_break_assigns() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 995
def test_render_to_string_doesnt_break_assigns
  get :render_to_string_with_assigns
  assert_equal "i'm before the render", @controller.instance_variable_get(:@before)
  assert_equal "i'm after the render", @controller.instance_variable_get(:@after)
end
test_render_to_string_inline() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 910
def test_render_to_string_inline
  get :render_to_string_with_inline_and_render
  assert_equal "Hello world!", @response.body
end
test_render_to_string_partial() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1133
def test_render_to_string_partial
  get :render_to_string_with_partial
  assert_equal "only partial", @controller.instance_variable_get(:@partial_only)
  assert_equal "Hello: david", @controller.instance_variable_get(:@partial_with_locals)
  assert_equal "text/html", @response.content_type
end
test_render_to_string_resets_assigns() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 905
def test_render_to_string_resets_assigns
  get :render_to_string_test
  assert_equal "The value of foo is: ::this is a test::\n", @response.body
end
test_render_to_string_that_throws_caught_exception_doesnt_break_assigns() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1005
def test_render_to_string_that_throws_caught_exception_doesnt_break_assigns
  assert_nothing_raised { get :render_to_string_with_caught_exception }
  assert_equal "i'm before the render", @controller.instance_variable_get(:@before)
  assert_equal "i'm after the render", @controller.instance_variable_get(:@after)
end
test_render_to_string_with_template_and_html_partial() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1140
def test_render_to_string_with_template_and_html_partial
  get :render_to_string_with_template_and_html_partial
  assert_equal "**only partial**\n", @controller.instance_variable_get(:@text)
  assert_equal "<strong>only partial</strong>\n", @controller.instance_variable_get(:@html)
  assert_equal "<strong>only html partial</strong>\n", @response.body
  assert_equal "text/html", @response.content_type
end
test_render_with_explicit_string_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1027
def test_render_with_explicit_string_template
  get :render_with_explicit_string_template
  assert_equal "<html>Hello world!</html>", @response.body
end
test_render_with_explicit_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1016
def test_render_with_explicit_template
  get :render_with_explicit_template
  assert_response :success
end
test_render_with_explicit_unescaped_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1021
def test_render_with_explicit_unescaped_template
  assert_raise(ActionView::MissingTemplate) { get :render_with_explicit_unescaped_template }
  get :render_with_explicit_escaped_template
  assert_equal "Hello w*rld!", @response.body
end
test_render_with_filters() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1032
def test_render_with_filters
  get :render_with_filters
  assert_equal "<test>passed formatted xml erb</test>", @response.body
end
test_render_with_forward_slash() click to toggle source

:ported: compatibility

# File actionview/test/actionpack/controller/render_test.rb, line 680
def test_render_with_forward_slash
  get :render_hello_world_with_forward_slash
  assert_equal "Hello world!", @response.body
end
test_render_xml() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 859
def test_render_xml
  get :render_xml_hello
  assert_equal "<html>\n  <p>Hello David</p>\n<p>This is grand!</p>\n</html>\n", @response.body
  assert_equal "application/xml", @response.content_type
end
test_render_xml_as_string_template() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 866
def test_render_xml_as_string_template
  get :render_xml_hello_as_string_template
  assert_equal "<html>\n  <p>Hello David</p>\n<p>This is grand!</p>\n</html>\n", @response.body
  assert_equal "application/xml", @response.content_type
end
test_render_xml_with_default() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 873
def test_render_xml_with_default
  get :greeting
  assert_equal "<p>This is grand!</p>\n", @response.body
end
test_render_xml_with_layouts() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 890
def test_render_xml_with_layouts
  get :builder_layout_test
  assert_equal "<wrapper>\n<html>\n  <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n", @response.body
end
test_render_xml_with_partial() click to toggle source

:move: test in AV

# File actionview/test/actionpack/controller/render_test.rb, line 879
def test_render_xml_with_partial
  get :builder_partial_test
  assert_equal "<test>\n  <hello/>\n</test>\n", @response.body
end
test_rendering_nothing_on_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 990
def test_rendering_nothing_on_layout
  get :rendering_nothing_on_layout
  assert_equal "", @response.body
end
test_rendering_with_conflicting_local_vars() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1056
def test_rendering_with_conflicting_local_vars
  get :rendering_with_conflicting_local_vars
  assert_equal("First: David\nSecond: Stephan\nThird: David\nFourth: David\nFifth: ", @response.body)
end
test_rendering_without_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 980
def test_rendering_without_layout
  get :rendering_without_layout
  assert_equal "Hello world!", @response.body
end
test_renders_default_template_for_missing_action() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 658
def test_renders_default_template_for_missing_action
  get :'hyphen-ated'
  assert_equal "hyphen-ated.erb", @response.body
end
test_should_implicitly_render_html_template_from_xhr_request() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 933
def test_should_implicitly_render_html_template_from_xhr_request
  get :render_implicit_html_template_from_xhr_request, xhr: true
  assert_equal "XHR!\nHello HTML!", @response.body
end
test_should_implicitly_render_js_template_without_layout() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 938
def test_should_implicitly_render_js_template_without_layout
  get :render_implicit_js_template_without_layout, format: :js, xhr: true
  assert_no_match %r{<html>}, @response.body
end
test_should_render_formatted_html_erb_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 948
def test_should_render_formatted_html_erb_template
  get :formatted_xml_erb
  assert_equal "<test>passed formatted html erb</test>", @response.body
end
test_should_render_formatted_html_erb_template_with_bad_accepts_header() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 953
def test_should_render_formatted_html_erb_template_with_bad_accepts_header
  @request.env["HTTP_ACCEPT"] = "; a=dsf"
  get :formatted_xml_erb
  assert_equal "<test>passed formatted html erb</test>", @response.body
end
test_should_render_formatted_html_erb_template_with_faulty_accepts_header() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 959
def test_should_render_formatted_html_erb_template_with_faulty_accepts_header
  @request.accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*"
  get :formatted_xml_erb
  assert_equal "<test>passed formatted html erb</test>", @response.body
end
test_should_render_formatted_template() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 943
def test_should_render_formatted_template
  get :formatted_html_erb
  assert_equal "formatted html erb", @response.body
end
test_should_render_html_formatted_partial() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1112
def test_should_render_html_formatted_partial
  get :partial
  assert_equal "partial html", @response.body
  assert_equal "text/html", @response.content_type
end
test_should_render_html_partial_with_formats() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1127
def test_should_render_html_partial_with_formats
  get :partial_formats_html
  assert_equal "partial html", @response.body
  assert_equal "text/html", @response.content_type
end
test_simple_show() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 650
def test_simple_show
  get :hello_world
  assert_response 200
  assert_response :success
  assert_equal "<html>Hello world!</html>", @response.body
end
test_template_with_locals() click to toggle source

:ported:

# File actionview/test/actionpack/controller/render_test.rb, line 1078
def test_template_with_locals
  get :render_with_explicit_template_with_locals
  assert_equal "The secret is area51\n", @response.body
end
test_using_layout_around_block() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1096
def test_using_layout_around_block
  get :render_using_layout_around_block
  assert_equal "Before (David)\nInside from block\nAfter", @response.body
end
test_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 1101
def test_using_layout_around_block_in_main_layout_and_within_content_for_layout
  get :render_using_layout_around_block_in_main_layout_and_within_content_for_layout
  assert_equal "Before (Anthony)\nInside from first block in layout\nAfter\nBefore (David)\nInside from block\nAfter\nBefore (Ramm)\nInside from second block in layout\nAfter\n", @response.body
end
test_yield_content_for() click to toggle source
# File actionview/test/actionpack/controller/render_test.rb, line 1083
def test_yield_content_for
  get :yield_content_for
  assert_equal "<title>Putting stuff in the title!</title>\nGreat stuff!\n", @response.body
end