Namespace
Methods
S
T
Constants
FILES_DIR = File.dirname(__FILE__) + '/../fixtures/multipart'
 
READ_BINARY = 'rb'
 
READ_PLAIN = 'r'
 
Instance Public methods
setup()
# File actionpack/test/controller/test_test.rb, line 140
def setup
  super
  @controller = TestController.new
  @request    = ActionController::TestRequest.new
  @response   = ActionController::TestResponse.new
  @request.env['PATH_INFO'] = nil
  @routes = ActionDispatch::Routing::RouteSet.new.tap do |r|
    r.draw do
      match ':controller(/:action(/:id))'
    end
  end
end
size()
# File actionpack/test/controller/test_test.rb, line 770
def size; 159528 end
test_action_dispatch_uploaded_file_upload()
# File actionpack/test/controller/test_test.rb, line 769
def test_action_dispatch_uploaded_file_upload
  tf = Class.new { def size; 159528 end }
  post :test_file_upload, :file => ActionDispatch::Http::UploadedFile.new(:tempfile => tf.new)
  assert_equal '159528', @response.body
end
test_array_path_parameter_handled_properly()
# File actionpack/test/controller/test_test.rb, line 577
def test_array_path_parameter_handled_properly
  with_routing do |set|
    set.draw do
      match 'file/*path', :to => 'test_test/test#test_params'
      match ':controller/:action'
    end

    get :test_params, :path => ['hello', 'world']
    assert_equal ['hello', 'world'], @request.path_parameters['path']
    assert_equal 'hello/world', @request.path_parameters['path'].to_s
  end
end
test_assert_generates()
# File actionpack/test/controller/test_test.rb, line 476
def test_assert_generates
  assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5'
  assert_generates 'controller/action/7', {:id => "7"}, {:controller => "controller", :action => "action"}
  assert_generates 'controller/action/5', {:controller => "controller", :action => "action", :id => "5", :name => "bob"}, {}, {:name => "bob"}
  assert_generates 'controller/action/7', {:id => "7", :name => "bob"}, {:controller => "controller", :action => "action"}, {:name => "bob"}
  assert_generates 'controller/action/7', {:id => "7"}, {:controller => "controller", :action => "action", :name => "bob"}, {}
end
test_assert_realistic_path_parameters()
# File actionpack/test/controller/test_test.rb, line 590
def test_assert_realistic_path_parameters
  get :test_params, :id => 20, :foo => Object.new

  # All elements of path_parameters should use string keys
  @request.path_parameters.keys.each do |key|
    assert_kind_of String, key
  end
end
test_assert_routing()
# File actionpack/test/controller/test_test.rb, line 484
def test_assert_routing
  assert_routing 'content', :controller => 'content', :action => 'index'
end
test_assert_routing_in_module()
# File actionpack/test/controller/test_test.rb, line 495
def test_assert_routing_in_module
  with_routing do |set|
    set.draw do
      namespace :admin do
        match 'user' => 'user#index'
      end
    end

    assert_routing 'admin/user', :controller => 'admin/user', :action => 'index'
  end
end
test_assert_routing_with_glob()
# File actionpack/test/controller/test_test.rb, line 507
def test_assert_routing_with_glob
  with_routing do |set|
    set.draw { match('*path' => "pages#show") }
    assert_routing('/company/about', { :controller => 'pages', :action => 'show', :path => 'company/about' })
  end
end
test_assert_routing_with_method()
# File actionpack/test/controller/test_test.rb, line 488
def test_assert_routing_with_method
  with_routing do |set|
    set.draw { resources(:content) }
    assert_routing({ :method => 'post', :path => 'content' }, { :controller => 'content', :action => 'create' })
  end
end
test_assert_tag_after()
# File actionpack/test/controller/test_test.rb, line 346
def test_assert_tag_after
  process :test_html_output

  # there is a tag following a sibling 'div' tag
  assert_tag :after => { :tag => "div" }
  # there is no tag following a sibling tag with id 'bar'
  assert_no_tag :after => { :attributes => { :id => "bar" } }
end
test_assert_tag_ancestor()
# File actionpack/test/controller/test_test.rb, line 319
def test_assert_tag_ancestor
  process :test_html_output

  # there is a 'li' tag with an ancestor having an id of 'foo'
  assert_tag :ancestor => { :attributes => { :id => "foo" } }, :tag => "li"
  # there is no tag of any kind with an ancestor having an href matching 'foo'
  assert_no_tag :ancestor => { :attributes => { :href => /foo/ } }
end
test_assert_tag_attribute_matching()
# File actionpack/test/controller/test_test.rb, line 459
def test_assert_tag_attribute_matching
  @response.body = '<input type="text" name="my_name">'
  assert_tag :tag => 'input',
               :attributes => { :name => /my/, :type => 'text' }
  assert_no_tag :tag => 'input',
               :attributes => { :name => 'my', :type => 'text' }
  assert_no_tag :tag => 'input',
               :attributes => { :name => /^my$/, :type => 'text' }
end
test_assert_tag_attributes()
# File actionpack/test/controller/test_test.rb, line 292
def test_assert_tag_attributes
  process :test_html_output

  # there is a tag with an 'id' of 'bar'
  assert_tag :attributes => { :id => "bar" }
  # there is no tag with a 'name' of 'baz'
  assert_no_tag :attributes => { :name => "baz" }
end
test_assert_tag_before()
# File actionpack/test/controller/test_test.rb, line 355
def test_assert_tag_before
  process :test_html_output

  # there is a tag preceding a tag with id 'bar'
  assert_tag :before => { :attributes => { :id => "bar" } }
  # there is no tag preceding a 'form' tag
  assert_no_tag :before => { :tag => "form" }
end
test_assert_tag_child()
# File actionpack/test/controller/test_test.rb, line 310
def test_assert_tag_child
  process :test_html_output

  # there is a tag with a child 'input' tag
  assert_tag :child => { :tag => "input" }
  # there is no tag with a child 'strong' tag
  assert_no_tag :child => { :tag => "strong" }
end
test_assert_tag_children_count()
# File actionpack/test/controller/test_test.rb, line 364
def test_assert_tag_children_count
  process :test_html_output

  # there is a tag with 2 children
  assert_tag :children => { :count => 2 }
  # in particular, there is a <ul> tag with two children (a nameless pair of <li>s)
  assert_tag :tag => 'ul', :children => { :count => 2 }
  # there is no tag with 4 children
  assert_no_tag :children => { :count => 4 }
end
test_assert_tag_children_greater_than()
# File actionpack/test/controller/test_test.rb, line 384
def test_assert_tag_children_greater_than
  process :test_html_output

  # there is a 'body' tag with more than 1 children
  assert_tag :children => { :greater_than => 1 }, :tag => "body"
  # there is no tag with more than 10 children
  assert_no_tag :children => { :greater_than => 10 }
end
test_assert_tag_children_less_than()
# File actionpack/test/controller/test_test.rb, line 375
def test_assert_tag_children_less_than
  process :test_html_output

  # there is a tag with less than 5 children
  assert_tag :children => { :less_than => 5 }
  # there is no 'ul' tag with less than 2 children
  assert_no_tag :children => { :less_than => 2 }, :tag => "ul"
end
test_assert_tag_children_only()
# File actionpack/test/controller/test_test.rb, line 393
def test_assert_tag_children_only
  process :test_html_output

  # there is a tag containing only one child with an id of 'foo'
  assert_tag :children => { :count => 1,
                            :only => { :attributes => { :id => "foo" } } }
  # there is no tag containing only one 'li' child
  assert_no_tag :children => { :count => 1, :only => { :tag => "li" } }
end
test_assert_tag_children_without_content()
# File actionpack/test/controller/test_test.rb, line 429
def test_assert_tag_children_without_content
  process :test_html_output

  # there is a form tag with an 'input' child which is a self closing tag
  assert_tag :tag => "form",
    :children => { :count => 1,
      :only => { :tag => "input" } }

  # the body tag has an 'a' child which in turn has an 'img' child
  assert_tag :tag => "body",
    :children => { :count => 1,
      :only => { :tag => "a",
        :children => { :count => 1,
          :only => { :tag => "img" } } } }
end
test_assert_tag_content()
# File actionpack/test/controller/test_test.rb, line 403
def test_assert_tag_content
  process :test_html_output

  # the output contains the string "Name"
  assert_tag :content => /Name/
  # the output does not contain the string "test"
  assert_no_tag :content => /test/
end
test_assert_tag_content_matching()
# File actionpack/test/controller/test_test.rb, line 469
def test_assert_tag_content_matching
  @response.body = "<p>hello world</p>"
  assert_tag :tag => "p", :content => "hello world"
  assert_tag :tag => "p", :content => /hello/
  assert_no_tag :tag => "p", :content => "hello"
end
test_assert_tag_descendant()
# File actionpack/test/controller/test_test.rb, line 328
def test_assert_tag_descendant
  process :test_html_output

  # there is a tag with a descendant 'li' tag
  assert_tag :descendant => { :tag => "li" }
  # there is no tag with a descendant 'html' tag
  assert_no_tag :descendant => { :tag => "html" }
end
test_assert_tag_multiple()
# File actionpack/test/controller/test_test.rb, line 412
def test_assert_tag_multiple
  process :test_html_output

  # there is a 'div', id='bar', with an immediate child whose 'action'
  # attribute matches the regexp /somewhere/.
  assert_tag :tag => "div", :attributes => { :id => "bar" },
             :child => { :attributes => { :action => /somewhere/ } }

  # there is no 'div', id='foo', with a 'ul' child with more than
  # 2 "li" children.
  assert_no_tag :tag => "div", :attributes => { :id => "foo" },
                :child => {
                  :tag => "ul",
                  :children => { :greater_than => 2,
                                 :only => { :tag => "li" } } }
end
test_assert_tag_parent()
# File actionpack/test/controller/test_test.rb, line 301
def test_assert_tag_parent
  process :test_html_output

  # there is a tag with a parent 'form' tag
  assert_tag :parent => { :tag => "form" }
  # there is no tag with a parent of 'input'
  assert_no_tag :parent => { :tag => "input" }
end
test_assert_tag_sibling()
# File actionpack/test/controller/test_test.rb, line 337
def test_assert_tag_sibling
  process :test_html_output

  # there is a tag with a sibling of class 'item'
  assert_tag :sibling => { :attributes => { :class => "item" } }
  # there is no tag with a sibling 'ul' tag
  assert_no_tag :sibling => { :tag => "ul" }
end
test_assert_tag_tag()
# File actionpack/test/controller/test_test.rb, line 283
def test_assert_tag_tag
  process :test_html_output

  # there is a 'form' tag
  assert_tag :tag => 'form'
  # there is not an 'hr' tag
  assert_no_tag :tag => 'hr'
end
test_assigns()
# File actionpack/test/controller/test_test.rb, line 263
def test_assigns
  process :test_assigns
  # assigns can be accessed using assigns(key)
  # or assigns[key], where key is a string or
  # a symbol
  assert_equal "foo", assigns(:foo)
  assert_equal "foo", assigns("foo")
  assert_equal "foo", assigns[:foo]
  assert_equal "foo", assigns["foo"]
end
test_body_stream()
# File actionpack/test/controller/test_test.rb, line 171
def test_body_stream
  params = ActiveSupport::OrderedHash[:page, { :name => 'page name' }, 'some key', 123]

  post :render_body, params.dup

  assert_equal params.to_query, @response.body
end
test_fixture_file_upload()
# File actionpack/test/controller/test_test.rb, line 764
def test_fixture_file_upload
  post :test_file_upload, :file => fixture_file_upload(FILES_DIR + "/mona_lisa.jpg", "image/jpg")
  assert_equal '159528', @response.body
end
test_fixture_file_upload_with_binary()
# File actionpack/test/controller/test_test.rb, line 752
def test_fixture_file_upload_with_binary
  filename = 'mona_lisa.jpg'
  path = "#{FILES_DIR}/#{filename}"
  content_type = 'image/jpg'

  binary_file_upload = fixture_file_upload(path, content_type, :binary)
  assert_equal File.open(path, READ_BINARY).read, binary_file_upload.read

  plain_file_upload = fixture_file_upload(path, content_type)
  assert_equal File.open(path, READ_PLAIN).read, plain_file_upload.read
end
test_fixture_path_is_accessed_from_self_instead_of_active_support_test_case()
# File actionpack/test/controller/test_test.rb, line 733
def test_fixture_path_is_accessed_from_self_instead_of_active_support_test_case
  TestTest.stubs(:fixture_path).returns(FILES_DIR)

  uploaded_file = fixture_file_upload('/mona_lisa.jpg', 'image/png')
  assert_equal File.open("#{FILES_DIR}/mona_lisa.jpg", READ_PLAIN).read, uploaded_file.read
end
test_header_properly_reset_after_get_request()
# File actionpack/test/controller/test_test.rb, line 627
def test_header_properly_reset_after_get_request
  get :test_params
  @request.recycle!
  assert_nil @request.instance_variable_get("@request_method")
end
test_header_properly_reset_after_remote_http_request()
# File actionpack/test/controller/test_test.rb, line 622
def test_header_properly_reset_after_remote_http_request
  xhr :get, :test_params
  assert_nil @request.env['HTTP_X_REQUESTED_WITH']
end
test_id_converted_to_string()
# File actionpack/test/controller/test_test.rb, line 572
def test_id_converted_to_string
  get :test_params, :id => 20, :foo => Object.new
  assert_kind_of String, @request.path_parameters['id']
end
test_multiple_calls()
# File actionpack/test/controller/test_test.rb, line 256
def test_multiple_calls
  process :test_only_one_param, :left => true
  assert_equal "OK", @response.body
  process :test_only_one_param, :right => true
  assert_equal "OK", @response.body
end
test_params_passing()
# File actionpack/test/controller/test_test.rb, line 514
def test_params_passing
  get :test_params, :page => {:name => "Page name", :month => '4', :year => '2004', :day => '6'}
  parsed_params = eval(@response.body)
  assert_equal(
    {'controller' => 'test_test/test', 'action' => 'test_params',
     'page' => {'name' => "Page name", 'month' => '4', 'year' => '2004', 'day' => '6'}},
    parsed_params
  )
end
test_params_passing_doesnt_modify_in_place()
# File actionpack/test/controller/test_test.rb, line 566
def test_params_passing_doesnt_modify_in_place
  page = {:name => "Page name", :month => 4, :year => 2004, :day => 6}
  get :test_params, :page => page
  assert_equal 2004, page[:year]
end
test_params_passing_path_parameter_is_string_when_not_html_request()
# File actionpack/test/controller/test_test.rb, line 544
def test_params_passing_path_parameter_is_string_when_not_html_request
  get :test_params, :format => 'json', :id => 1
  parsed_params = eval(@response.body)
  assert_equal(
    {'controller' => 'test_test/test', 'action' => 'test_params',
     'format' => 'json', 'id' => '1' },
    parsed_params
  )
end
test_params_passing_with_fixnums()
# File actionpack/test/controller/test_test.rb, line 524
def test_params_passing_with_fixnums
  get :test_params, :page => {:name => "Page name", :month => 4, :year => 2004, :day => 6}
  parsed_params = eval(@response.body)
  assert_equal(
    {'controller' => 'test_test/test', 'action' => 'test_params',
     'page' => {'name' => "Page name", 'month' => '4', 'year' => '2004', 'day' => '6'}},
    parsed_params
  )
end
test_params_passing_with_fixnums_when_not_html_request()
# File actionpack/test/controller/test_test.rb, line 534
def test_params_passing_with_fixnums_when_not_html_request
  get :test_params, :format => 'json', :count => 999
  parsed_params = eval(@response.body)
  assert_equal(
    {'controller' => 'test_test/test', 'action' => 'test_params',
     'format' => 'json', 'count' => 999 },
    parsed_params
  )
end
test_params_passing_with_frozen_values()
# File actionpack/test/controller/test_test.rb, line 554
def test_params_passing_with_frozen_values
  assert_nothing_raised do
    get :test_params, :frozen => 'icy'.freeze, :frozens => ['icy'.freeze].freeze, :deepfreeze => { :frozen => 'icy'.freeze }.freeze
  end
  parsed_params = eval(@response.body)
  assert_equal(
    {'controller' => 'test_test/test', 'action' => 'test_params',
     'frozen' => 'icy', 'frozens' => ['icy'], 'deepfreeze' => { 'frozen' => 'icy' }},
    parsed_params
  )
end
test_params_reset_after_post_request()
# File actionpack/test/controller/test_test.rb, line 633
def test_params_reset_after_post_request
  post :no_op, :foo => "bar"
  assert_equal "bar", @request.params[:foo]
  @request.recycle!
  post :no_op
  assert_blank @request.params[:foo]
end
test_process_with_flash()
# File actionpack/test/controller/test_test.rb, line 184
def test_process_with_flash
  process :set_flash, nil, nil, { "test" => "value" }
  assert_equal '>value<', flash['test']
end
test_process_with_flash_now()
# File actionpack/test/controller/test_test.rb, line 189
def test_process_with_flash_now
  process :set_flash_now, nil, nil, { "test_now" => "value_now" }
  assert_equal '>value_now<', flash['test_now']
end
test_process_with_query_string()
# File actionpack/test/controller/test_test.rb, line 244
def test_process_with_query_string
  process :test_query_string, :q => 'test'
  assert_equal "q=test", @response.body
end
test_process_with_query_string_with_explicit_uri()
# File actionpack/test/controller/test_test.rb, line 249
def test_process_with_query_string_with_explicit_uri
  @request.env['PATH_INFO'] = '/explicit/uri'
  @request.env['QUERY_STRING'] = 'q=test?extra=question'
  process :test_query_string
  assert_equal "q=test?extra=question", @response.body
end
test_process_with_request_uri_with_no_params()
# File actionpack/test/controller/test_test.rb, line 228
def test_process_with_request_uri_with_no_params
  process :test_uri
  assert_equal "/test_test/test/test_uri", @response.body
end
test_process_with_request_uri_with_params()
# File actionpack/test/controller/test_test.rb, line 233
def test_process_with_request_uri_with_params
  process :test_uri, :id => 7
  assert_equal "/test_test/test/test_uri/7", @response.body
end
test_process_with_request_uri_with_params_with_explicit_uri()
# File actionpack/test/controller/test_test.rb, line 238
def test_process_with_request_uri_with_params_with_explicit_uri
  @request.env['PATH_INFO'] = "/explicit/uri"
  process :test_uri, :id => 7
  assert_equal "/explicit/uri", @response.body
end
test_process_with_session()
# File actionpack/test/controller/test_test.rb, line 194
def test_process_with_session
  process :set_session
  assert_equal 'A wonder', session['string'], "A value stored in the session should be available by string key"
  assert_equal 'A wonder', session[:string], "Test session hash should allow indifferent access"
  assert_equal 'it works', session['symbol'], "Test session hash should allow indifferent access"
  assert_equal 'it works', session[:symbol], "Test session hash should allow indifferent access"
end
test_process_with_session_arg()
# File actionpack/test/controller/test_test.rb, line 202
def test_process_with_session_arg
  process :no_op, nil, { 'string' => 'value1', :symbol => 'value2' }
  assert_equal 'value1', session['string']
  assert_equal 'value1', session[:string]
  assert_equal 'value2', session['symbol']
  assert_equal 'value2', session[:symbol]
end
test_process_without_flash()
# File actionpack/test/controller/test_test.rb, line 179
def test_process_without_flash
  process :set_flash
  assert_equal '><', flash['test']
end
test_raw_post_handling()
# File actionpack/test/controller/test_test.rb, line 164
def test_raw_post_handling
  params = ActiveSupport::OrderedHash[:page, {:name => 'page name'}, 'some key', 123]
  post :render_raw_post, params.dup

  assert_equal params.to_query, @response.body
end
test_redirect_url_only_cares_about_location_header()
# File actionpack/test/controller/test_test.rb, line 779
def test_redirect_url_only_cares_about_location_header
  get :create
  assert_response :created

  # Redirect url doesn't care that it wasn't a :redirect response.
  assert_equal 'created resource', @response.redirect_url
  assert_equal @response.redirect_url, redirect_to_url

  # Must be a :redirect response.
  assert_raise(ActiveSupport::TestCase::Assertion) do
    assert_redirected_to 'created resource'
  end
end
test_remote_addr()
# File actionpack/test/controller/test_test.rb, line 613
def test_remote_addr
  get :test_remote_addr
  assert_equal "0.0.0.0", @response.body

  @request.remote_addr = "192.0.0.1"
  get :test_remote_addr
  assert_equal "192.0.0.1", @response.body
end
test_request_format()
# File actionpack/test/controller/test_test.rb, line 662
def test_request_format
  get :test_format, :format => 'html'
  assert_equal 'text/html', @response.body

  get :test_format, :format => 'json'
  assert_equal 'application/json', @response.body

  get :test_format, :format => 'xml'
  assert_equal 'application/xml', @response.body

  get :test_format
  assert_equal 'text/html', @response.body
end
test_request_protocol_is_reset_after_request()
# File actionpack/test/controller/test_test.rb, line 649
def test_request_protocol_is_reset_after_request
  get :test_protocol
  assert_equal "http://", @response.body

  @request.env["HTTPS"] = "on"
  get :test_protocol
  assert_equal "https://", @response.body

  @request.env.delete("HTTPS")
  get :test_protocol
  assert_equal "http://", @response.body
end
test_response_and_request_have_nice_accessors()
# File actionpack/test/controller/test_test.rb, line 222
def test_response_and_request_have_nice_accessors
  process :no_op
  assert_equal @response, response
  assert_equal @request, request
end
test_session_is_cleared_from_controller_after_reset_session()
# File actionpack/test/controller/test_test.rb, line 210
def test_session_is_cleared_from_controller_after_reset_session
  process :set_session
  process :reset_the_session
  assert_equal Hash.new, @controller.session.to_hash
end
test_session_is_cleared_from_request_after_reset_session()
# File actionpack/test/controller/test_test.rb, line 216
def test_session_is_cleared_from_request_after_reset_session
  process :set_session
  process :reset_the_session
  assert_equal Hash.new, @request.session.to_hash
end
test_should_not_impose_childless_html_tags_in_xml()
# File actionpack/test/controller/test_test.rb, line 445
def test_should_not_impose_childless_html_tags_in_xml
  process :test_xml_output

  begin
    $stderr = StringIO.new
    assert_select 'area' #This will cause a warning if content is processed as HTML
    $stderr.rewind && err = $stderr.read
  ensure
    $stderr = STDERR
  end

  assert err.empty?
end
test_symbolized_path_params_reset_after_request()
# File actionpack/test/controller/test_test.rb, line 641
def test_symbolized_path_params_reset_after_request
  get :test_params, :id => "foo"
  assert_equal "foo", @request.symbolized_path_parameters[:id]
  @request.recycle!
  get :test_params
  assert_nil @request.symbolized_path_parameters[:id]
end
test_test_uploaded_file()
# File actionpack/test/controller/test_test.rb, line 714
def test_test_uploaded_file
  filename = 'mona_lisa.jpg'
  path = "#{FILES_DIR}/#{filename}"
  content_type = 'image/png'
  expected = File.read(path)
  expected.force_encoding(Encoding::BINARY) if expected.respond_to?(:force_encoding)

  file = Rack::Test::UploadedFile.new(path, content_type)
  assert_equal filename, file.original_filename
  assert_equal content_type, file.content_type
  assert_equal file.path, file.local_path
  assert_equal expected, file.read

  new_content_type = "new content_type"
  file.content_type = new_content_type
  assert_equal new_content_type, file.content_type

end
test_test_uploaded_file_exception_when_file_doesnt_exist()
# File actionpack/test/controller/test_test.rb, line 775
def test_test_uploaded_file_exception_when_file_doesnt_exist
  assert_raise(RuntimeError) { Rack::Test::UploadedFile.new('non_existent_file') }
end
test_test_uploaded_file_with_binary()
# File actionpack/test/controller/test_test.rb, line 740
def test_test_uploaded_file_with_binary
  filename = 'mona_lisa.jpg'
  path = "#{FILES_DIR}/#{filename}"
  content_type = 'image/png'

  binary_uploaded_file = Rack::Test::UploadedFile.new(path, content_type, :binary)
  assert_equal File.open(path, READ_BINARY).read, binary_uploaded_file.read

  plain_uploaded_file = Rack::Test::UploadedFile.new(path, content_type)
  assert_equal File.open(path, READ_PLAIN).read, plain_uploaded_file.read
end
test_view_assigns()
# File actionpack/test/controller/test_test.rb, line 274
def test_view_assigns
  @controller = ViewAssignsController.new
  process :test_assigns
  assert_equal nil, assigns(:foo)
  assert_equal nil, assigns[:foo]
  assert_equal "bar", assigns(:bar)
  assert_equal "bar", assigns[:bar]
end
test_with_routing_places_routes_back()
# File actionpack/test/controller/test_test.rb, line 599
def test_with_routing_places_routes_back
  assert @routes
  routes_id = @routes.object_id

  begin
    with_routing { raise 'fail' }
    fail 'Should not be here.'
  rescue RuntimeError
  end

  assert @routes
  assert_equal routes_id, @routes.object_id
end