2009-10-12 07:37:42 -04:00
|
|
|
require 'test/test_helper'
|
|
|
|
|
|
|
|
class MapRoutingTest < ActionController::TestCase
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map new user session' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'new'}, {:path => 'users/sign_in', :method => :get})
|
2009-10-12 07:37:42 -04:00
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map create user session' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'create'}, {:path => 'users/sign_in', :method => :post})
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map destroy user session' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => 'users/sign_out', :method => :get})
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map new user confirmation' do
|
2009-10-12 07:37:42 -04:00
|
|
|
assert_recognizes({:controller => 'confirmations', :action => 'new'}, 'users/confirmation/new')
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map create user confirmation' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'confirmations', :action => 'create'}, {:path => 'users/confirmation', :method => :post})
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map show user confirmation' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'confirmations', :action => 'show'}, {:path => 'users/confirmation', :method => :get})
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map new user password' do
|
2009-10-12 07:37:42 -04:00
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'new'}, 'users/password/new')
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map create user password' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'create'}, {:path => 'users/password', :method => :post})
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map edit user password' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'edit'}, 'users/password/edit')
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map update user password' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'update'}, {:path => 'users/password', :method => :put})
|
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map admin session with :as option' do
|
2009-10-16 12:44:51 -04:00
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'new'}, {:path => 'admin_area/sign_in', :method => :get})
|
2009-10-12 07:37:42 -04:00
|
|
|
end
|
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'does not map admin confirmation' do
|
2009-10-12 08:56:12 -04:00
|
|
|
assert_raise ActionController::RoutingError do
|
2009-10-12 20:49:51 -04:00
|
|
|
assert_recognizes({:controller => 'confirmations', :action => 'new'}, 'admin_area/confirmation/new')
|
2009-10-12 08:56:12 -04:00
|
|
|
end
|
2009-10-12 07:37:42 -04:00
|
|
|
end
|
2009-10-12 09:18:14 -04:00
|
|
|
|
2009-10-16 19:46:06 -04:00
|
|
|
test 'map account with custom path name for session sign in' do
|
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'new'}, 'account/login')
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'map account with custom path name for session sign out' do
|
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'destroy'}, 'account/logout')
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'map account with custom path name for password' do
|
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'new'}, 'account/secret/new')
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'map account with custom path name for confirmation' do
|
|
|
|
assert_recognizes({:controller => 'confirmations', :action => 'new'}, 'account/verification/new')
|
|
|
|
end
|
|
|
|
|
2009-10-18 10:08:07 -04:00
|
|
|
test 'map organizer with custom singular name' do
|
2009-11-13 05:49:22 -05:00
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'new', :locale => "en", :extra => 'value'}, '/en/organizers/password/new')
|
2009-11-06 11:27:27 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'map organizer with path prefix' do
|
2009-11-13 05:49:22 -05:00
|
|
|
assert_recognizes({:controller => 'sessions', :action => 'new', :locale => "en", :extra => 'value'}, '/en/organizers/sign_in')
|
2009-10-18 10:08:07 -04:00
|
|
|
end
|
|
|
|
|
2009-11-13 05:49:22 -05:00
|
|
|
test 'map organizer with additional route options' do
|
|
|
|
assert_recognizes({:controller => 'passwords', :action => 'new', :locale => "en", :extra => 'value'}, '/en/organizers/password/new')
|
|
|
|
end
|
2009-10-12 07:37:42 -04:00
|
|
|
end
|