X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/b01261760893de04dda650a427ceb59beea80004..90e46a58de583ac2bd7bb43077faa94186957a7a:/test/functional/user_blocks_controller_test.rb diff --git a/test/functional/user_blocks_controller_test.rb b/test/functional/user_blocks_controller_test.rb new file mode 100644 index 000000000..adf0f3631 --- /dev/null +++ b/test/functional/user_blocks_controller_test.rb @@ -0,0 +1,58 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class UserBlocksControllerTest < ActionController::TestCase + ## + # test all routes which lead to this controller + def test_routes + assert_routing( + { :path => "/blocks/new/username", :method => :get }, + { :controller => "user_blocks", :action => "new", :display_name => "username" } + ) + + assert_routing( + { :path => "/user_blocks", :method => :get }, + { :controller => "user_blocks", :action => "index" } + ) + assert_routing( + { :path => "/user_blocks/new", :method => :get }, + { :controller => "user_blocks", :action => "new" } + ) + assert_routing( + { :path => "/user_blocks", :method => :post }, + { :controller => "user_blocks", :action => "create" } + ) + assert_routing( + { :path => "/user_blocks/1", :method => :get }, + { :controller => "user_blocks", :action => "show", :id => "1" } + ) + assert_routing( + { :path => "/user_blocks/1/edit", :method => :get }, + { :controller => "user_blocks", :action => "edit", :id => "1" } + ) + assert_routing( + { :path => "/user_blocks/1", :method => :put }, + { :controller => "user_blocks", :action => "update", :id => "1" } + ) + assert_routing( + { :path => "/user_blocks/1", :method => :delete }, + { :controller => "user_blocks", :action => "destroy", :id => "1" } + ) + assert_routing( + { :path => "/blocks/1/revoke", :method => :get }, + { :controller => "user_blocks", :action => "revoke", :id => "1" } + ) + assert_routing( + { :path => "/blocks/1/revoke", :method => :post }, + { :controller => "user_blocks", :action => "revoke", :id => "1" } + ) + + assert_routing( + { :path => "/user/username/blocks", :method => :get }, + { :controller => "user_blocks", :action => "blocks_on", :display_name => "username" } + ) + assert_routing( + { :path => "/user/username/blocks_by", :method => :get }, + { :controller => "user_blocks", :action => "blocks_by", :display_name => "username" } + ) + end +end