class RenderXmlTest

Public Instance Methods

setup() click to toggle source
Calls superclass method
# File actionpack/test/controller/render_xml_test.rb, line 49
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)

  @request.host = "www.nextangle.com"
end
test_rendering_with_location_should_set_header() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 58
def test_rendering_with_location_should_set_header
  get :render_with_location
  assert_equal "http://example.com", @response.headers["Location"]
end
test_rendering_with_object_location_should_set_header_with_url_for() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 73
def test_rendering_with_object_location_should_set_header_with_url_for
  with_routing do |set|
    set.draw do
      resources :customers

      ActiveSupport::Deprecation.silence do
        get ":controller/:action"
      end
    end

    get :render_with_object_location
    assert_equal "http://www.nextangle.com/customers/1", @response.headers["Location"]
  end
end
test_rendering_xml_should_call_to_xml_if_possible() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 63
def test_rendering_xml_should_call_to_xml_if_possible
  get :render_with_to_xml
  assert_equal "<i-am-xml/>", @response.body
end
test_rendering_xml_should_call_to_xml_with_extra_options() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 68
def test_rendering_xml_should_call_to_xml_with_extra_options
  get :render_xml_with_custom_options
  assert_equal "<i-am-THE-xml/>", @response.body
end
test_should_render_formatted_xml_erb_template() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 88
def test_should_render_formatted_xml_erb_template
  get :formatted_xml_erb, format: :xml
  assert_equal "<test>passed formatted xml erb</test>", @response.body
end
test_should_render_xml_but_keep_custom_content_type() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 93
def test_should_render_xml_but_keep_custom_content_type
  get :render_xml_with_custom_content_type
  assert_equal "application/atomsvc+xml", @response.content_type
end
test_should_use_implicit_content_type() click to toggle source
# File actionpack/test/controller/render_xml_test.rb, line 98
def test_should_use_implicit_content_type
  get :implicit_content_type, format: "atom"
  assert_equal Mime[:atom], @response.content_type
end