mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Allow :skip => :all
This commit is contained in:
parent
ea7f15917f
commit
261c01dfa3
3 changed files with 8 additions and 0 deletions
|
@ -78,6 +78,8 @@ module Devise
|
|||
|
||||
if options.has_key?(:only)
|
||||
@used_routes = self.routes & Array(options[:only]).map(&singularizer)
|
||||
elsif options[:skip] == :all
|
||||
@used_routes = []
|
||||
else
|
||||
@used_routes = self.routes - Array(options[:skip]).map(&singularizer)
|
||||
end
|
||||
|
|
|
@ -31,6 +31,10 @@ class MappingTest < ActiveSupport::TestCase
|
|||
assert_equal "admin_area", Devise.mappings[:admin].path
|
||||
end
|
||||
|
||||
test 'allows to skip all routes' do
|
||||
assert_equal [], Devise.mappings[:skip_admin].used_routes
|
||||
end
|
||||
|
||||
test 'sign_out_via defaults to :get' do
|
||||
assert_equal :get, Devise.mappings[:user].sign_out_via
|
||||
end
|
||||
|
|
|
@ -50,6 +50,8 @@ Rails.application.routes.draw do
|
|||
constraints(:host => /192\.168\.1\.\d\d\d/) do
|
||||
devise_for :homebase_admin, :class_name => "Admin", :path => "homebase"
|
||||
end
|
||||
|
||||
devise_for :skip_admin, :class_name => "Admin", :skip => :all
|
||||
|
||||
# Routes for format=false testing
|
||||
devise_for :htmlonly_admin, :class_name => "Admin", :skip => [:confirmations, :unlocks], :path => "htmlonly_admin", :format => false, :skip_helpers => [:confirmations, :unlocks]
|
||||
|
|
Loading…
Reference in a new issue