1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Merge pull request #2802 from schneems/schneems/raise_controller_omniauthable

[close #2755] Raise incompatible route error
This commit is contained in:
José Valim 2013-12-20 00:53:23 -08:00
commit 29da146c07
2 changed files with 16 additions and 0 deletions

View file

@ -229,6 +229,14 @@ module ActionDispatch::Routing
raise_no_devise_method_error!(mapping.class_name)
end
if options[:controllers] && options[:controllers][:omniauth_callbacks]
unless mapping.omniauthable?
msg = "Mapping omniauth_callbacks on a resource that is not omniauthable\n"
msg << "Please add `devise :omniauthable` to the `#{mapping.class_name}` model"
raise msg
end
end
routes = mapping.used_routes
devise_scope mapping.name do

View file

@ -235,6 +235,14 @@ class CustomizedRoutingTest < ActionController::TestCase
test 'map with format false is not permanent' do
assert_equal "/set.xml", @routes.url_helpers.set_path(:xml)
end
test 'checks if mapping has proper configuration for omniauth callback' do
assert_raise ArgumentError do
@routes.dup.eval_block do
devise_for :admin, controllers: {omniauth_callbacks: "users/omniauth_callbacks"}
end
end
end
end
class ScopedRoutingTest < ActionController::TestCase