Permalink
Browse files

Allow :skip => :all

  • Loading branch information...
1 parent ea7f159 commit 261c01dfa3be4ba1fc57fc93c30b878ac5120260 @josevalim josevalim committed Sep 14, 2011
Showing with 8 additions and 0 deletions.
  1. +2 −0 lib/devise/mapping.rb
  2. +4 −0 test/mapping_test.rb
  3. +2 −0 test/rails_app/config/routes.rb
@@ -78,6 +78,8 @@ def initialize(name, options) #:nodoc:
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 @@ def fake_request(path, params={})
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 @@
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]

0 comments on commit 261c01d

Please sign in to comment.