test/routes_test.rb in loyal_devise-2.1.2 vs test/routes_test.rb in loyal_devise-2.1.3

- old
+ new

@@ -1,8 +1,9 @@ -# -*- encoding : utf-8 -*- require 'test_helper' +ExpectedRoutingError = Devise.rails4? ? MiniTest::Assertion : ActionController::RoutingError + class DefaultRoutingTest < ActionController::TestCase test 'map new user session' do assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => 'users/sign_in', :method => :get}) assert_named_route "/users/sign_in", :new_user_session_path end @@ -100,11 +101,11 @@ # named open_id assert_recognizes({:controller => 'users/omniauth_callbacks', :action => 'google'}, {:path => 'users/auth/google/callback', :method => :get}) assert_recognizes({:controller => 'users/omniauth_callbacks', :action => 'google'}, {:path => 'users/auth/google/callback', :method => :post}) assert_named_route "/users/auth/google/callback", :user_omniauth_callback_path, :google - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'ysers/omniauth_callbacks', :action => 'twitter'}, {:path => 'users/auth/twitter/callback', :method => :get}) end end protected @@ -122,21 +123,21 @@ test 'map admin with :controllers option' do assert_recognizes({:controller => 'admins/sessions', :action => 'new'}, {:path => 'admin_area/sign_in', :method => :get}) end test 'does not map admin password' do - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'admin_area/password/new') end end test 'subdomain admin' do assert_recognizes({"host"=>"sub.example.com", :controller => 'devise/sessions', :action => 'new'}, {:host => "sub.example.com", :path => '/sub_admin/sign_in', :method => :get}) end test 'does only map reader password' do - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, 'reader/sessions/new') end assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'reader/password/new') end @@ -160,74 +161,74 @@ assert_recognizes({:controller => 'devise/registrations', :action => 'cancel', :locale => 'en'}, '/en/accounts/management/giveup') end test 'map deletes with :sign_out_via option' do assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/deletes/sign_out', :method => :delete}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/deletes/sign_out', :method => :get}) end end test 'map posts with :sign_out_via option' do assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/posts/sign_out', :method => :post}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/posts/sign_out', :method => :get}) end end test 'map delete_or_posts with :sign_out_via option' do assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :post}) assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :delete}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :get}) end end - + test 'map with constraints defined in hash' do assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://192.168.1.100/headquarters/sign_up', :method => :get}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://10.0.0.100/headquarters/sign_up', :method => :get}) end end - + test 'map with constraints defined in block' do assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://192.168.1.100/homebase/sign_up', :method => :get}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://10.0.0.100//homebase/sign_up', :method => :get}) end end - + test 'map with format false for sessions' do assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => '/htmlonly_admin/sign_in', :method => :get}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => '/htmlonly_admin/sign_in.xml', :method => :get}) end end - + test 'map with format false for passwords' do assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => '/htmlonly_admin/password', :method => :post}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => '/htmlonly_admin/password.xml', :method => :post}) end end - + test 'map with format false for registrations' do assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => '/htmlonly_admin/sign_up', :method => :get}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => '/htmlonly_admin/sign_up.xml', :method => :get}) end end - + test 'map with format false for confirmations' do assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => '/htmlonly_users/confirmation', :method => :get}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => '/htmlonly_users/confirmation.xml', :method => :get}) end end - + test 'map with format false for unlocks' do assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => '/htmlonly_users/unlock', :method => :get}) - assert_raise ActionController::RoutingError do + assert_raise ExpectedRoutingError do assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => '/htmlonly_users/unlock.xml', :method => :get}) end end test 'map with format false is not permanent' do