- S
- T
-
- test_access_to_request_in_view,
- test_accessing_params_in_template,
- test_accessing_params_in_template_with_layout,
- test_action_talk_to_layout,
- test_attempt_to_access_object_method,
- test_bad_render_to_string_still_throws_exception,
- test_do_with_render,
- test_do_with_render_action,
- test_do_with_render_action_and_layout_false,
- test_do_with_render_action_as_symbol,
- test_do_with_render_custom_code,
- test_do_with_render_from_variable,
- test_do_with_render_text,
- test_do_with_render_text_and_layout,
- test_double_redirect,
- test_double_render,
- test_empty_partial_collection,
- test_enum_rjs_test,
- test_head_with_custom_header,
- test_head_with_integer_status,
- test_head_with_location_header,
- test_head_with_status_code_first,
- test_head_with_string_status,
- test_head_with_symbolic_status,
- test_layout_overriding_layout,
- test_layout_rendering,
- test_layout_test_with_different_layout,
- test_nested_rendering,
- test_overwritting_rendering_relative_file_with_extension,
- test_partial_collection,
- test_partial_collection_with_locals,
- test_partial_only,
- test_partial_only_with_layout,
- test_partial_with_hash_object,
- test_partial_with_implicit_local_assignment,
- test_partial_with_locals,
- test_partials_list,
- test_private_methods,
- test_render_and_redirect,
- test_render_file_not_using_full_path,
- test_render_file_not_using_full_path_with_dot_in_path,
- test_render_file_not_using_full_path_with_relative_path,
- test_render_file_with_instance_variables,
- test_render_file_with_locals,
- test_render_rjs_template_explicitly,
- test_render_rjs_with_default,
- test_render_text_with_assigns,
- test_render_to_string,
- test_render_to_string_and_render,
- test_render_to_string_doesnt_break_assigns,
- test_render_to_string_partial,
- test_render_to_string_that_throws_caught_exception_doesnt_break_assigns,
- test_render_with_explicit_template,
- test_render_xml,
- test_render_xml_with_default,
- test_render_xml_with_layouts,
- test_rendering_nothing_on_layout,
- test_rendering_rjs_action_explicitly,
- test_rendering_with_conflicting_local_vars,
- test_rendering_without_layout,
- test_simple_show,
- test_update_page,
- test_update_page_with_instance_variables,
- test_yield_content_for
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 357 def setup @controller = NewRenderTestController.new # 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". @controller.logger = Logger.new(nil) @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.host = "www.nextangle.com" end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 450 def test_access_to_request_in_view view_internals_old_value = ActionController::Base.view_controller_internals ActionController::Base.view_controller_internals = false ActionController::Base.protected_variables_cache = nil get :hello_world assert !assigns.include?('request'), 'request should not be in assigns' ActionController::Base.view_controller_internals = true ActionController::Base.protected_variables_cache = nil get :hello_world assert assigns.include?('request'), 'request should be in assigns' assert_deprecated 'request' do assert_kind_of ActionController::AbstractRequest, assigns['request'] end assert_not_deprecated do assert_kind_of ActionController::AbstractRequest, @response.template.request assert_kind_of ActionController::AbstractRequest, assigns['_request'] end ensure ActionController::Base.view_controller_internals = view_internals_old_value ActionController::Base.protected_variables_cache = nil end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 586 def test_accessing_params_in_template get :accessing_params_in_template, :name => "David" assert_equal "Hello: David", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 591 def test_accessing_params_in_template_with_layout get :accessing_params_in_template_with_layout, :name => "David" assert_equal "<html>Hello: David</html>", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 624 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 442 def test_attempt_to_access_object_method assert_raises(ActionController::UnknownAction, "No action responded to [clone]") { get :clone } end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 571 def test_bad_render_to_string_still_throws_exception assert_raises(ActionController::MissingTemplate) { get :render_to_string_with_exception } end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 377 def test_do_with_render get :render_hello_world assert_template "test/hello_world" end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 387 def test_do_with_render_action get :render_action_hello_world assert_template "test/hello_world" end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 407 def test_do_with_render_action_and_layout_false get :hello_world_with_layout_false assert_equal 'Hello world!', @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 392 def test_do_with_render_action_as_symbol get :render_action_hello_world_as_symbol assert_template "test/hello_world" end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 412 def test_do_with_render_custom_code get :render_custom_code assert_response :missing end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 382 def test_do_with_render_from_variable get :render_hello_world_from_variable assert_equal "hello david", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 397 def test_do_with_render_text get :render_text_hello_world assert_equal "hello world", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 402 def test_do_with_render_text_and_layout get :render_text_hello_world_with_layout assert_equal "<html>hello world, I'm here!</html>", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 605 def test_double_redirect assert_raises(ActionController::DoubleRenderError) { get :double_redirect } end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 601 def test_double_render assert_raises(ActionController::DoubleRenderError) { get :double_render } end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 649 def test_empty_partial_collection get :empty_partial_collection assert_equal " ", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 482 def test_enum_rjs_test get :enum_rjs_test assert_equal "$$(".product").each(function(value, index) { new Effect.Highlight(element,{}); new Effect.Highlight(value,{}); Sortable.create(value, {onUpdate:function(){new Ajax.Request('/test/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(value)})}}); new Draggable(value, {}); }); ".strip, @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 706 def test_head_with_custom_header get :head_with_custom_header assert @response.body.blank? assert_equal "something", @response.headers["X-Custom-Header"] assert_response :ok end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 729 def test_head_with_integer_status ActionController::StatusCodes::STATUS_CODES.each do |code, message| get :head_with_integer_status, :status => code.to_s assert_equal message, @response.message end end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 699 def test_head_with_location_header get :head_with_location_header assert @response.body.blank? assert_equal "/foo", @response.headers["Location"] assert_response :ok end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 743 def test_head_with_status_code_first get :head_with_status_code_first assert_equal 403, @response.response_code assert_equal "Forbidden", @response.message assert_equal "something", @response.headers["X-Custom-Header"] assert_response :forbidden end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 736 def test_head_with_string_status get :head_with_string_status, :status => "404 Eat Dirt" assert_equal 404, @response.response_code assert_equal "Eat Dirt", @response.message assert_response :not_found end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 713 def test_head_with_symbolic_status get :head_with_symbolic_status, :status => "ok" assert_equal "200 OK", @response.headers["Status"] assert_response :ok get :head_with_symbolic_status, :status => "not_found" assert_equal "404 Not Found", @response.headers["Status"] assert_response :not_found ActionController::StatusCodes::SYMBOL_TO_STATUS_CODE.each do |status, code| get :head_with_symbolic_status, :status => status.to_s assert_equal code, @response.response_code assert_response status end end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 529 def test_layout_overriding_layout get :layout_overriding_layout assert_no_match %r{<title>}, @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 514 def test_layout_rendering get :layout_test assert_equal "<html>Hello world!</html>", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 519 def test_layout_test_with_different_layout get :layout_test_with_different_layout assert_equal "<html>Hello world!</html>", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 581 def test_nested_rendering get :hello_world assert_equal "Living in a nested world", Fun::GamesController.process(@request, @response).body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 690 def test_overwritting_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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 639 def test_partial_collection get :partial_collection assert_equal "Hello: davidHello: mary", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 644 def test_partial_collection_with_locals get :partial_collection_with_locals assert_equal "Bonjour: davidBonjour: mary", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 544 def test_partial_only get :partial_only assert_equal "only partial", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 549 def test_partial_only_with_layout get :partial_only_with_layout assert_equal "<html>only partial</html>", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 654 def test_partial_with_hash_object get :partial_with_hash_object assert_equal "Sam", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 659 def test_partial_with_implicit_local_assignment get :partial_with_implicit_local_assignment assert_equal "Hello: Marcel", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 634 def test_partial_with_locals get :partial_with_locals assert_equal "Hello: david", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 629 def test_partials_list get :partials_list assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 446 def test_private_methods assert_raises(ActionController::UnknownAction, "No action responded to [determine_layout]") { get :determine_layout } end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 609 def test_render_and_redirect assert_raises(ActionController::DoubleRenderError) { get :render_and_redirect } end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 422 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 432 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 427 def test_render_file_not_using_full_path_with_relative_path get :render_file_not_using_full_path_with_relative_path assert_equal "The secret is in the sauce\n", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 417 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 437 def test_render_file_with_locals get :render_file_with_locals assert_equal "The secret is in the sauce\n", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 504 def test_render_rjs_template_explicitly get :render_js_with_explicit_template assert_equal %QElement.remove("person");\nnew Effect.Highlight(\"project-4\",{});!, @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 499 def test_render_rjs_with_default get :delete_with_js assert_equal %QElement.remove("person");\nnew Effect.Highlight(\"project-4\",{});!, @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 664 def test_render_text_with_assigns get :render_text_with_assigns assert_equal "world", assigns["hello"] end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 554 def test_render_to_string assert_not_deprecated { get :hello_in_a_string } assert_equal "How's there? goodbyeHello: davidHello: marygoodbye\n", @response.body end
specify the one exception to double render rule - render_to_string followed by render
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 614 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 559 def test_render_to_string_doesnt_break_assigns get :render_to_string_with_assigns assert_equal "i'm before the render", assigns(:before) assert_equal "i'm after the render", assigns(:after) end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 565 def test_render_to_string_partial get :render_to_string_with_partial assert_equal "only partial", assigns(:partial_only) assert_equal "Hello: david", assigns(:partial_with_locals) end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 575 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", assigns(:before) assert_equal "i'm after the render", assigns(:after) end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 596 def test_render_with_explicit_template assert_deprecated(%rrender/) { get :render_with_explicit_template } assert_response :success end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 477 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 end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 494 def test_render_xml_with_default get :greeting assert_equal "<p>This is grand!</p>\n", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 539 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 534 def test_rendering_nothing_on_layout get :rendering_nothing_on_layout assert_equal " ", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 509 def test_rendering_rjs_action_explicitly get :render_js_with_explicit_action_template assert_equal %QElement.remove("person");\nnew Effect.Highlight(\"project-4\",{});!, @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 619 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
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 524 def test_rendering_without_layout get :rendering_without_layout assert_equal "Hello world!", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 370 def test_simple_show get :hello_world assert_response :success assert_template "test/hello_world" assert_equal "<html>Hello world!</html>", @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 669 def test_update_page get :update_page assert_template nil assert_equal 'text/javascript; charset=utf-8', @response.headers['Content-Type'] assert_equal 2, @response.body.split($/).length end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 676 def test_update_page_with_instance_variables get :update_page_with_instance_variables assert_template nil assert_equal 'text/javascript; charset=utf-8', @response.headers['Content-Type'] assert_match %rbalance/, @response.body assert_match %r\$37/, @response.body end
Source: show
# File rails/actionpack/test/controller/new_render_test.rb, line 684 def test_yield_content_for assert_not_deprecated { get :yield_content_for } assert_equal "<title>Putting stuff in the title!</title>\n\nGreat stuff!\n", @response.body end