Methods
- R
- S
- T
-
- teardown,
- test_all,
- test_browser_check_with_any_any,
- test_custom_constant,
- test_custom_constant_handling_without_block,
- test_custom_types,
- test_extension_synonyms,
- test_firefox_simulation,
- test_forced_format,
- test_format_with_custom_response_type,
- test_format_with_custom_response_type_and_request_headers,
- test_handle_any,
- test_handle_any_any,
- test_handle_any_any_explicit_html,
- test_handle_any_any_javascript,
- test_handle_any_any_parameter_format,
- test_handle_any_any_xml,
- test_html,
- test_html_type_with_layout,
- test_internally_forced_format,
- test_invalid_format,
- test_js_or_anything,
- test_js_or_html,
- test_json_or_yaml,
- test_json_or_yaml_with_leading_star_star,
- test_render_action_for_html,
- test_synonyms,
- test_using_defaults,
- test_using_defaults_with_type_list,
- test_with_atom_content_type,
- test_with_rss_content_type,
- test_xhr,
- test_xhtml_alias,
- test_xml
Instance Public methods
render(*args)
Link
setup()
Link
teardown()
Link
test_all()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 218 def test_all @request.accept = "*/*" get :js_or_html assert_equal 'HTML', @response.body # js is not part of all get :html_or_xml assert_equal 'HTML', @response.body get :just_xml assert_equal 'XML', @response.body end
test_browser_check_with_any_any()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 408 def test_browser_check_with_any_any @request.accept = "application/json, application/xml" get :json_xml_or_html assert_equal 'JSON', @response.body @request.accept = "application/json, application/xml, */*" get :json_xml_or_html assert_equal 'HTML', @response.body end
test_custom_constant()
Link
test_custom_constant_handling_without_block()
Link
test_custom_types()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 341 def test_custom_types @request.accept = "application/crazy-xml" get :custom_type_handling assert_equal "application/crazy-xml", @response.content_type assert_equal 'Crazy XML', @response.body @request.accept = "text/html" get :custom_type_handling assert_equal "text/html", @response.content_type assert_equal 'HTML', @response.body end
test_extension_synonyms()
Link
test_firefox_simulation()
Link
test_forced_format()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 441 def test_forced_format get :html_xml_or_rss assert_equal "HTML", @response.body get :html_xml_or_rss, :format => "html" assert_equal "HTML", @response.body get :html_xml_or_rss, :format => "xml" assert_equal "XML", @response.body get :html_xml_or_rss, :format => "rss" assert_equal "RSS", @response.body end
test_format_with_custom_response_type()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 485 def test_format_with_custom_response_type get :iphone_with_html_response_type assert_equal '<html><div id="html">Hello future from Firefox!</div></html>', @response.body get :iphone_with_html_response_type, :format => "iphone" assert_equal "text/html", @response.content_type assert_equal '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body end
test_format_with_custom_response_type_and_request_headers()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 494 def test_format_with_custom_response_type_and_request_headers @request.accept = "text/iphone" get :iphone_with_html_response_type assert_equal '<html><div id="iphone">Hello iPhone future from iPhone!</div></html>', @response.body assert_equal "text/html", @response.content_type end
test_handle_any()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 365 def test_handle_any @request.accept = "*/*" get :handle_any assert_equal 'HTML', @response.body @request.accept = "text/javascript" get :handle_any assert_equal 'Either JS or XML', @response.body @request.accept = "text/xml" get :handle_any assert_equal 'Either JS or XML', @response.body end
test_handle_any_any()
Link
test_handle_any_any_explicit_html()
Link
test_handle_any_any_javascript()
Link
test_handle_any_any_parameter_format()
Link
test_handle_any_any_xml()
Link
test_html()
Link
test_html_type_with_layout()
Link
test_internally_forced_format()
Link
test_invalid_format()
Link
test_js_or_anything()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 281 def test_js_or_anything @request.accept = "text/javascript, */*" xhr :get, :js_or_html assert_equal 'JS', @response.body xhr :get, :html_or_xml assert_equal 'HTML', @response.body xhr :get, :just_xml assert_equal 'XML', @response.body end
test_js_or_html()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 236 def test_js_or_html @request.accept = "text/javascript, text/html" xhr :get, :js_or_html assert_equal 'JS', @response.body @request.accept = "text/javascript, text/html" xhr :get, :html_or_xml assert_equal 'HTML', @response.body @request.accept = "text/javascript, text/html" xhr :get, :just_xml assert_response 406 end
test_json_or_yaml()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 260 def test_json_or_yaml xhr :get, :json_or_yaml assert_equal 'JSON', @response.body get :json_or_yaml, :format => 'json' assert_equal 'JSON', @response.body get :json_or_yaml, :format => 'yaml' assert_equal 'YAML', @response.body { 'YAML' => %w(text/yaml), 'JSON' => %w(application/json text/x-json) }.each do |body, content_types| content_types.each do |content_type| @request.accept = content_type get :json_or_yaml assert_equal body, @response.body end end end
test_json_or_yaml_with_leading_star_star()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 250 def test_json_or_yaml_with_leading_star_star @request.accept = "*/*, application/json" get :json_xml_or_html assert_equal 'HTML', @response.body @request.accept = "*/* , application/json" get :json_xml_or_html assert_equal 'HTML', @response.body end
test_render_action_for_html()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 468 def test_render_action_for_html @controller.instance_eval do def render(*args) @action = args.first[:action] unless args.empty? @action ||= action_name response.body = "#{@action} - #{formats}" end end get :using_defaults assert_equal "using_defaults - #{[:html].to_s}", @response.body get :using_defaults, :format => "xml" assert_equal "using_defaults - #{[:xml].to_s}", @response.body end
test_synonyms()
Link
test_using_defaults()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 293 def test_using_defaults @request.accept = "*/*" get :using_defaults assert_equal "text/html", @response.content_type assert_equal 'Hello world!', @response.body @request.accept = "application/xml" get :using_defaults assert_equal "application/xml", @response.content_type assert_equal "<p>Hello world!</p>\n", @response.body end
test_using_defaults_with_type_list()
Link
# File actionpack/test/controller/mime_responds_test.rb, line 305 def test_using_defaults_with_type_list @request.accept = "*/*" get :using_defaults_with_type_list assert_equal "text/html", @response.content_type assert_equal 'Hello world!', @response.body @request.accept = "application/xml" get :using_defaults_with_type_list assert_equal "application/xml", @response.content_type assert_equal "<p>Hello world!</p>\n", @response.body end
test_with_atom_content_type()
Link
test_with_rss_content_type()
Link
test_xhr()
Link
test_xhtml_alias()
Link