You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users_test.rb 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Redmine - project management software
  2. # Copyright (C) 2006-2014 Jean-Philippe Lang
  3. #
  4. # This program is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU General Public License
  6. # as published by the Free Software Foundation; either version 2
  7. # of the License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. require File.expand_path('../../../test_helper', __FILE__)
  18. class RoutingUsersTest < ActionController::IntegrationTest
  19. def test_users
  20. assert_routing(
  21. { :method => 'get', :path => "/users" },
  22. { :controller => 'users', :action => 'index' }
  23. )
  24. assert_routing(
  25. { :method => 'get', :path => "/users.xml" },
  26. { :controller => 'users', :action => 'index', :format => 'xml' }
  27. )
  28. assert_routing(
  29. { :method => 'get', :path => "/users/44" },
  30. { :controller => 'users', :action => 'show', :id => '44' }
  31. )
  32. assert_routing(
  33. { :method => 'get', :path => "/users/44.xml" },
  34. { :controller => 'users', :action => 'show', :id => '44',
  35. :format => 'xml' }
  36. )
  37. assert_routing(
  38. { :method => 'get', :path => "/users/current" },
  39. { :controller => 'users', :action => 'show', :id => 'current' }
  40. )
  41. assert_routing(
  42. { :method => 'get', :path => "/users/current.xml" },
  43. { :controller => 'users', :action => 'show', :id => 'current',
  44. :format => 'xml' }
  45. )
  46. assert_routing(
  47. { :method => 'get', :path => "/users/new" },
  48. { :controller => 'users', :action => 'new' }
  49. )
  50. assert_routing(
  51. { :method => 'get', :path => "/users/444/edit" },
  52. { :controller => 'users', :action => 'edit', :id => '444' }
  53. )
  54. assert_routing(
  55. { :method => 'post', :path => "/users" },
  56. { :controller => 'users', :action => 'create' }
  57. )
  58. assert_routing(
  59. { :method => 'post', :path => "/users.xml" },
  60. { :controller => 'users', :action => 'create', :format => 'xml' }
  61. )
  62. assert_routing(
  63. { :method => 'put', :path => "/users/444" },
  64. { :controller => 'users', :action => 'update', :id => '444' }
  65. )
  66. assert_routing(
  67. { :method => 'put', :path => "/users/444.xml" },
  68. { :controller => 'users', :action => 'update', :id => '444',
  69. :format => 'xml' }
  70. )
  71. assert_routing(
  72. { :method => 'delete', :path => "/users/44" },
  73. { :controller => 'users', :action => 'destroy', :id => '44' }
  74. )
  75. assert_routing(
  76. { :method => 'delete', :path => "/users/44.xml" },
  77. { :controller => 'users', :action => 'destroy', :id => '44',
  78. :format => 'xml' }
  79. )
  80. assert_routing(
  81. { :method => 'post', :path => "/users/123/memberships" },
  82. { :controller => 'users', :action => 'edit_membership',
  83. :id => '123' }
  84. )
  85. assert_routing(
  86. { :method => 'put', :path => "/users/123/memberships/55" },
  87. { :controller => 'users', :action => 'edit_membership',
  88. :id => '123', :membership_id => '55' }
  89. )
  90. assert_routing(
  91. { :method => 'delete', :path => "/users/123/memberships/55" },
  92. { :controller => 'users', :action => 'destroy_membership',
  93. :id => '123', :membership_id => '55' }
  94. )
  95. end
  96. end