devise 1.0.11 → 1.1.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (121) hide show
  1. data/CHANGELOG.rdoc +6 -72
  2. data/Gemfile +18 -0
  3. data/README.rdoc +51 -46
  4. data/Rakefile +5 -4
  5. data/app/controllers/{confirmations_controller.rb → devise/confirmations_controller.rb} +2 -2
  6. data/app/controllers/{passwords_controller.rb → devise/passwords_controller.rb} +4 -3
  7. data/app/controllers/{registrations_controller.rb → devise/registrations_controller.rb} +11 -7
  8. data/app/controllers/{sessions_controller.rb → devise/sessions_controller.rb} +11 -8
  9. data/app/controllers/{unlocks_controller.rb → devise/unlocks_controller.rb} +2 -10
  10. data/app/models/devise/mailer.rb +55 -0
  11. data/app/views/{confirmations → devise/confirmations}/new.html.erb +1 -1
  12. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  13. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  14. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  15. data/app/views/{passwords → devise/passwords}/edit.html.erb +1 -1
  16. data/app/views/{passwords → devise/passwords}/new.html.erb +1 -1
  17. data/app/views/{registrations → devise/registrations}/edit.html.erb +1 -1
  18. data/app/views/{registrations → devise/registrations}/new.html.erb +1 -1
  19. data/app/views/{sessions → devise/sessions}/new.html.erb +1 -1
  20. data/app/views/{shared/_devise_links.erb → devise/shared/_links.erb} +0 -0
  21. data/app/views/{unlocks → devise/unlocks}/new.html.erb +1 -1
  22. data/{lib/devise → config}/locales/en.yml +7 -1
  23. data/lib/devise.rb +6 -29
  24. data/lib/devise/controllers/helpers.rb +16 -43
  25. data/lib/devise/controllers/internal_helpers.rb +10 -36
  26. data/lib/devise/controllers/scoped_views.rb +35 -0
  27. data/lib/devise/failure_app.rb +7 -14
  28. data/lib/devise/hooks/rememberable.rb +3 -6
  29. data/lib/devise/hooks/trackable.rb +1 -1
  30. data/lib/devise/mapping.rb +17 -18
  31. data/lib/devise/models.rb +4 -20
  32. data/lib/devise/models/{database_authenticatable.rb → authenticatable.rb} +16 -28
  33. data/lib/devise/models/confirmable.rb +25 -23
  34. data/lib/devise/models/http_authenticatable.rb +3 -7
  35. data/lib/devise/models/lockable.rb +40 -35
  36. data/lib/devise/models/recoverable.rb +4 -8
  37. data/lib/devise/models/rememberable.rb +6 -9
  38. data/lib/devise/models/timeoutable.rb +1 -3
  39. data/lib/devise/models/token_authenticatable.rb +4 -5
  40. data/lib/devise/models/validatable.rb +10 -1
  41. data/lib/devise/orm/mongo_mapper.rb +10 -23
  42. data/lib/devise/rails.rb +11 -9
  43. data/lib/devise/rails/routes.rb +113 -107
  44. data/lib/devise/rails/warden_compat.rb +3 -41
  45. data/lib/devise/schema.rb +13 -21
  46. data/lib/devise/strategies/{database_authenticatable.rb → authenticatable.rb} +3 -3
  47. data/lib/devise/strategies/http_authenticatable.rb +4 -22
  48. data/lib/devise/test_helpers.rb +1 -8
  49. data/lib/devise/version.rb +1 -1
  50. data/lib/generators/devise/devise_generator.rb +57 -0
  51. data/{generators → lib/generators}/devise/templates/migration.rb +1 -1
  52. data/lib/generators/devise_install/devise_install_generator.rb +25 -0
  53. data/{generators → lib/generators}/devise_install/templates/README +4 -8
  54. data/{generators → lib/generators}/devise_install/templates/devise.rb +0 -3
  55. data/lib/generators/devise_views/devise_views_generator.rb +11 -0
  56. data/test/controllers/helpers_test.rb +15 -9
  57. data/test/devise_test.rb +1 -6
  58. data/test/encryptors_test.rb +0 -3
  59. data/test/failure_app_test.rb +6 -1
  60. data/test/integration/authenticatable_test.rb +25 -85
  61. data/test/integration/http_authenticatable_test.rb +2 -10
  62. data/test/integration/lockable_test.rb +3 -22
  63. data/test/integration/recoverable_test.rb +1 -1
  64. data/test/integration/registerable_test.rb +31 -36
  65. data/test/integration/rememberable_test.rb +6 -24
  66. data/test/integration/token_authenticatable_test.rb +2 -4
  67. data/test/integration/trackable_test.rb +1 -1
  68. data/test/mailers/confirmation_instructions_test.rb +4 -10
  69. data/test/mailers/unlock_instructions_test.rb +1 -1
  70. data/test/mapping_test.rb +12 -24
  71. data/test/models/authenticatable_test.rb +3 -3
  72. data/test/models/confirmable_test.rb +29 -29
  73. data/test/models/http_authenticatable_test.rb +19 -0
  74. data/test/models/lockable_test.rb +45 -44
  75. data/test/models/recoverable_test.rb +7 -7
  76. data/test/models/rememberable_test.rb +7 -10
  77. data/test/models/validatable_test.rb +19 -24
  78. data/test/models_test.rb +2 -16
  79. data/test/orm/active_record.rb +3 -4
  80. data/test/orm/mongo_mapper.rb +2 -10
  81. data/test/rails_app/app/active_record/admin.rb +1 -1
  82. data/test/rails_app/app/active_record/user.rb +3 -3
  83. data/test/rails_app/app/controllers/application_controller.rb +1 -7
  84. data/test/rails_app/app/controllers/sessions_controller.rb +6 -0
  85. data/test/rails_app/app/controllers/users_controller.rb +0 -4
  86. data/test/rails_app/app/mongo_mapper/admin.rb +4 -7
  87. data/test/rails_app/app/mongo_mapper/user.rb +5 -8
  88. data/test/rails_app/config/application.rb +32 -0
  89. data/test/rails_app/config/boot.rb +7 -108
  90. data/test/rails_app/config/environment.rb +4 -41
  91. data/test/rails_app/config/environments/development.rb +15 -13
  92. data/test/rails_app/config/environments/production.rb +25 -20
  93. data/test/rails_app/config/environments/test.rb +23 -22
  94. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  95. data/test/rails_app/config/initializers/cookie_verification_secret.rb +7 -0
  96. data/test/rails_app/config/initializers/devise.rb +0 -3
  97. data/test/rails_app/config/initializers/session_store.rb +2 -2
  98. data/test/rails_app/config/routes.rb +17 -21
  99. data/test/routes_test.rb +30 -47
  100. data/test/support/{assertions_helper.rb → assertions.rb} +0 -15
  101. data/test/support/{tests_helper.rb → helpers.rb} +16 -3
  102. data/test/support/{integration_tests_helper.rb → integration.rb} +8 -4
  103. data/test/support/webrat/integrations/rails.rb +31 -0
  104. data/test/test_helper.rb +8 -7
  105. data/test/test_helpers_test.rb +9 -9
  106. metadata +53 -128
  107. data/app/models/devise_mailer.rb +0 -68
  108. data/app/views/devise_mailer/confirmation_instructions.html.erb +0 -5
  109. data/app/views/devise_mailer/reset_password_instructions.html.erb +0 -8
  110. data/app/views/devise_mailer/unlock_instructions.html.erb +0 -7
  111. data/generators/devise/USAGE +0 -5
  112. data/generators/devise/devise_generator.rb +0 -15
  113. data/generators/devise/lib/route_devise.rb +0 -32
  114. data/generators/devise/templates/model.rb +0 -9
  115. data/generators/devise_install/USAGE +0 -3
  116. data/generators/devise_install/devise_install_generator.rb +0 -15
  117. data/generators/devise_views/USAGE +0 -3
  118. data/generators/devise_views/devise_views_generator.rb +0 -21
  119. data/rails/init.rb +0 -2
  120. data/test/integration/rack_middleware_test.rb +0 -47
  121. data/test/rails_app/config/initializers/new_rails_defaults.rb +0 -24
@@ -1,42 +1,5 @@
1
- # Be sure to restart your server when you modify this file
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
2
3
 
3
- # Specifies gem version of Rails to use when vendor/rails is not present
4
- RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
5
- DEVISE_ORM = :active_record unless defined? DEVISE_ORM
6
-
7
- # Bootstrap the Rails environment, frameworks, and default configuration
8
- require File.join(File.dirname(__FILE__), 'boot')
9
-
10
- Rails::Initializer.run do |config|
11
- # Settings in config/environments/* take precedence over those specified here.
12
- # Application configuration should go into files in config/initializers
13
- # -- all .rb files in that directory are automatically loaded.
14
-
15
- # Add additional load paths for your own custom dirs
16
- config.autoload_paths += [ "#{RAILS_ROOT}/app/#{DEVISE_ORM}/" ]
17
-
18
- # Specify gems that this application depends on and have them installed with rake gems:install
19
- # config.gem "bj"
20
- # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
21
- # config.gem "sqlite3-ruby", :lib => "sqlite3"
22
- # config.gem "aws-s3", :lib => "aws/s3"
23
-
24
- # Only load the plugins named here, in the order given (default is alphabetical).
25
- # :all can be used as a placeholder for all plugins not explicitly named
26
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
27
-
28
- # Skip frameworks you're not going to use. To use Rails without a database,
29
- # you must remove the Active Record framework.
30
- config.frameworks -= [ :active_record ] unless DEVISE_ORM == :active_record
31
-
32
- # Activate observers that should always be running
33
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
34
-
35
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
36
- # Run "rake -D time" for a list of tasks for finding time zone names.
37
- config.time_zone = 'UTC'
38
-
39
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
40
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
41
- # config.i18n.default_locale = :en
42
- end
4
+ # Initialize the rails application
5
+ RailsApp::Application.initialize!
@@ -1,17 +1,19 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
2
3
 
3
- # In the development environment your application's code is reloaded on
4
- # every request. This slows down response time but is perfect for development
5
- # since you don't have to restart the webserver when you make code changes.
6
- config.cache_classes = false
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
7
8
 
8
- # Log error messages when you accidentally call methods on nil.
9
- config.whiny_nils = true
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
10
11
 
11
- # Show full error reports and disable caching
12
- config.action_controller.consider_all_requests_local = true
13
- config.action_view.debug_rjs = true
14
- config.action_controller.perform_caching = false
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_view.debug_rjs = true
15
+ config.action_controller.perform_caching = false
15
16
 
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+ end
@@ -1,28 +1,33 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
2
3
 
3
- # The production environment is meant for finished, "live" apps.
4
- # Code is not reloaded between requests
5
- config.cache_classes = true
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
6
7
 
7
- # Full error reports are disabled and caching is turned on
8
- config.action_controller.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
- config.action_view.cache_template_loading = true
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
11
 
12
- # See everything in the log (default is :info)
13
- # config.log_level = :debug
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
14
 
15
- # Use a different logger for distributed setups
16
- # config.logger = SyslogLogger.new
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
17
 
18
- # Use a different cache store in production
19
- # config.cache_store = :mem_cache_store
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
20
 
21
- # Enable serving of images, stylesheets, and javascripts from an asset server
22
- # config.action_controller.asset_host = "http://assets.example.com"
21
+ # Disable Rails's static asset server
22
+ # In production, Apache or nginx will already do this
23
+ config.serve_static_assets = false
23
24
 
24
- # Disable delivery errors, bad email addresses will be ignored
25
- # config.action_mailer.raise_delivery_errors = false
25
+ # Enable serving of images, stylesheets, and javascripts from an asset server
26
+ # config.action_controller.asset_host = "http://assets.example.com"
26
27
 
27
- # Enable threaded mode
28
- # config.threadsafe!
28
+ # Disable delivery errors, bad email addresses will be ignored
29
+ # config.action_mailer.raise_delivery_errors = false
30
+
31
+ # Enable threaded mode
32
+ # config.threadsafe!
33
+ end
@@ -1,28 +1,29 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
2
3
 
3
- # The test environment is used exclusively to run your application's
4
- # test suite. You never need to work with it otherwise. Remember that
5
- # your test database is "scratch space" for the test suite and is wiped
6
- # and recreated between test runs. Don't rely on the data there!
7
- config.cache_classes = true
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
8
9
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
11
12
 
12
- # Show full error reports and disable caching
13
- config.action_controller.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
- config.action_view.cache_template_loading = true
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
16
 
17
- # Disable request forgery protection in test environment
18
- config.action_controller.allow_forgery_protection = false
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
19
 
20
- # Tell Action Mailer not to deliver emails to the real world.
21
- # The :test delivery method accumulates sent emails in the
22
- # ActionMailer::Base.deliveries array.
23
- config.action_mailer.delivery_method = :test
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
24
 
25
- # Use SQL instead of Active Record's schema dumper when creating the test database.
26
- # This is necessary if your schema can't be completely dumped by the schema dumper,
27
- # like if you have constraints or database-specific column types
28
- # config.active_record.schema_format = :sql
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
29
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.cookie_verifier_secret = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
@@ -35,9 +35,6 @@ Devise.setup do |config|
35
35
 
36
36
  # Configure the e-mail address which will be shown in DeviseMailer.
37
37
  config.mailer_sender = "please-change-me-omg@yourapp.com"
38
-
39
- # Configure the content type of DeviseMailer mails (defaults to text/html")
40
- # config.mailer_content_type = "text/plain"
41
38
 
42
39
  # Load and configure the ORM. Supports :active_record, :data_mapper and :mongo_mapper.
43
40
  require "devise/orm/#{DEVISE_ORM}"
@@ -5,8 +5,8 @@
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
7
  ActionController::Base.session = {
8
- :key => '_rails_app_session',
9
- :secret => '89e8147901a0d7c221ac130e0ded3eeab6dab4a97127255909f08fedaae371918b41dec9d4d75c5b27a55c3772d43c2b6a3cbac232c5cc2ce4b8ec22242f5e60'
8
+ :key => '_rails_app_session',
9
+ :secret => '0c31f123b2bd4424ac366a7976aaa0696f0c82337c4073a5816a3abc6553293ad14f70cf23acb391954a8ce8cf08aaca3fab21e7642aa52ea212aefa19b7439d'
10
10
  }
11
11
 
12
12
  # Use the database for sessions instead of the cookie-based default,
@@ -1,25 +1,21 @@
1
- ActionController::Routing::Routes.draw do |map|
2
- map.devise_for :users
3
- map.devise_for :admin, :as => 'admin_area'
4
- map.devise_for :accounts, :scope => 'manager', :path_prefix => ':locale',
5
- :class_name => "User", :requirements => { :extra => 'value' }, :path_names => {
6
- :sign_in => 'login', :sign_out => 'logout',
7
- :password => 'secret', :confirmation => 'verification',
8
- :unlock => 'unblock', :sign_up => 'register'
9
- }
1
+ Rails::Application.routes.draw do
2
+ resources :users, :only => [:index] do
3
+ get :expire, :on => :member
4
+ end
10
5
 
11
- map.resources :users, :only => [:index], :member => { :expire => :get }
12
- map.resources :admins, :only => :index
13
- map.root :controller => :home
6
+ resources :admins, :only => [:index]
14
7
 
15
- map.devise_for :sign_out_via_deletes, :sign_out_via => :delete, :class_name => "User"
16
- map.devise_for :sign_out_via_posts, :sign_out_via => :post, :class_name => "User"
17
- map.devise_for :sign_out_via_anymethods, :sign_out_via => :any, :class_name => "User"
8
+ devise_for :users
9
+ devise_for :admin, :as => "admin_area", :controllers => { :sessions => "sessions" }
10
+ devise_for :accounts, :scope => "manager", :path_prefix => ":locale",
11
+ :class_name => "User", :path_names => {
12
+ :sign_in => "login", :sign_out => "logout",
13
+ :password => "secret", :confirmation => "verification",
14
+ :unlock => "unblock", :sign_up => "register"
15
+ }
18
16
 
19
- map.connect '/admin_area/password/new', :controller => "passwords", :action => "new"
20
- map.admin_root '/admin_area/home', :controller => "admins", :action => "index"
17
+ match "/admin_area/home", :to => "admins#index", :as => :admin_root
18
+ match "/sign_in", :to => "devise/sessions#new"
21
19
 
22
- map.connect '/sign_in', :controller => "sessions", :action => "new"
23
- map.connect ':controller/:action/:id'
24
- map.connect ':controller/:action/:id.:format'
25
- end
20
+ root :to => "home#index"
21
+ end
@@ -3,129 +3,112 @@ require 'test/test_helper'
3
3
  class MapRoutingTest < ActionController::TestCase
4
4
 
5
5
  test 'map new user session' do
6
- assert_recognizes({:controller => 'sessions', :action => 'new'}, {:path => 'users/sign_in', :method => :get})
6
+ assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => 'users/sign_in', :method => :get})
7
7
  end
8
8
 
9
9
  test 'map create user session' do
10
- assert_recognizes({:controller => 'sessions', :action => 'create'}, {:path => 'users/sign_in', :method => :post})
10
+ assert_recognizes({:controller => 'devise/sessions', :action => 'create'}, {:path => 'users/sign_in', :method => :post})
11
11
  end
12
12
 
13
13
  test 'map destroy user session' do
14
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => 'users/sign_out', :method => :get})
14
+ assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => 'users/sign_out', :method => :get})
15
15
  end
16
16
 
17
17
  test 'map new user confirmation' do
18
- assert_recognizes({:controller => 'confirmations', :action => 'new'}, 'users/confirmation/new')
18
+ assert_recognizes({:controller => 'devise/confirmations', :action => 'new'}, 'users/confirmation/new')
19
19
  end
20
20
 
21
21
  test 'map create user confirmation' do
22
- assert_recognizes({:controller => 'confirmations', :action => 'create'}, {:path => 'users/confirmation', :method => :post})
22
+ assert_recognizes({:controller => 'devise/confirmations', :action => 'create'}, {:path => 'users/confirmation', :method => :post})
23
23
  end
24
24
 
25
25
  test 'map show user confirmation' do
26
- assert_recognizes({:controller => 'confirmations', :action => 'show'}, {:path => 'users/confirmation', :method => :get})
26
+ assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => 'users/confirmation', :method => :get})
27
27
  end
28
28
 
29
29
  test 'map new user password' do
30
- assert_recognizes({:controller => 'passwords', :action => 'new'}, 'users/password/new')
30
+ assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'users/password/new')
31
31
  end
32
32
 
33
33
  test 'map create user password' do
34
- assert_recognizes({:controller => 'passwords', :action => 'create'}, {:path => 'users/password', :method => :post})
34
+ assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => 'users/password', :method => :post})
35
35
  end
36
36
 
37
37
  test 'map edit user password' do
38
- assert_recognizes({:controller => 'passwords', :action => 'edit'}, 'users/password/edit')
38
+ assert_recognizes({:controller => 'devise/passwords', :action => 'edit'}, 'users/password/edit')
39
39
  end
40
40
 
41
41
  test 'map update user password' do
42
- assert_recognizes({:controller => 'passwords', :action => 'update'}, {:path => 'users/password', :method => :put})
42
+ assert_recognizes({:controller => 'devise/passwords', :action => 'update'}, {:path => 'users/password', :method => :put})
43
43
  end
44
44
 
45
45
  test 'map new user unlock' do
46
- assert_recognizes({:controller => 'unlocks', :action => 'new'}, 'users/unlock/new')
46
+ assert_recognizes({:controller => 'devise/unlocks', :action => 'new'}, 'users/unlock/new')
47
47
  end
48
48
 
49
49
  test 'map create user unlock' do
50
- assert_recognizes({:controller => 'unlocks', :action => 'create'}, {:path => 'users/unlock', :method => :post})
50
+ assert_recognizes({:controller => 'devise/unlocks', :action => 'create'}, {:path => 'users/unlock', :method => :post})
51
51
  end
52
52
 
53
53
  test 'map show user unlock' do
54
- assert_recognizes({:controller => 'unlocks', :action => 'show'}, {:path => 'users/unlock', :method => :get})
54
+ assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => 'users/unlock', :method => :get})
55
55
  end
56
56
 
57
57
  test 'map new user registration' do
58
- assert_recognizes({:controller => 'registrations', :action => 'new'}, 'users/sign_up')
58
+ assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, 'users/sign_up')
59
59
  end
60
60
 
61
61
  test 'map create user registration' do
62
- assert_recognizes({:controller => 'registrations', :action => 'create'}, {:path => 'users', :method => :post})
62
+ assert_recognizes({:controller => 'devise/registrations', :action => 'create'}, {:path => 'users', :method => :post})
63
63
  end
64
64
 
65
65
  test 'map edit user registration' do
66
- assert_recognizes({:controller => 'registrations', :action => 'edit'}, {:path => 'users/edit', :method => :get})
66
+ assert_recognizes({:controller => 'devise/registrations', :action => 'edit'}, {:path => 'users/edit', :method => :get})
67
67
  end
68
68
 
69
69
  test 'map update user registration' do
70
- assert_recognizes({:controller => 'registrations', :action => 'update'}, {:path => 'users', :method => :put})
70
+ assert_recognizes({:controller => 'devise/registrations', :action => 'update'}, {:path => 'users', :method => :put})
71
71
  end
72
72
 
73
73
  test 'map destroy user registration' do
74
- assert_recognizes({:controller => 'registrations', :action => 'destroy'}, {:path => 'users', :method => :delete})
74
+ assert_recognizes({:controller => 'devise/registrations', :action => 'destroy'}, {:path => 'users', :method => :delete})
75
75
  end
76
76
 
77
- test 'map admin session with :as option' do
77
+ test 'map admin with :as option' do
78
+ assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'admin_area/sign_up', :method => :get})
79
+ end
80
+
81
+ test 'map admin with :controllers option' do
78
82
  assert_recognizes({:controller => 'sessions', :action => 'new'}, {:path => 'admin_area/sign_in', :method => :get})
79
83
  end
80
84
 
81
85
  test 'does not map admin confirmation' do
82
86
  assert_raise ActionController::RoutingError do
83
- assert_recognizes({:controller => 'confirmations', :action => 'new'}, 'admin_area/confirmation/new')
87
+ assert_recognizes({:controller => 'devise/confirmations', :action => 'new'}, 'admin_area/confirmation/new')
84
88
  end
85
89
  end
86
90
 
87
91
  test 'map account with custom path name for session sign in' do
88
- assert_recognizes({:controller => 'sessions', :action => 'new', :locale => 'en', :extra => 'value'}, '/en/accounts/login')
92
+ assert_recognizes({:controller => 'devise/sessions', :action => 'new', :locale => 'en'}, '/en/accounts/login')
89
93
  end
90
94
 
91
95
  test 'map account with custom path name for session sign out' do
92
- assert_recognizes({:controller => 'sessions', :action => 'destroy', :locale => 'en', :extra => 'value'}, '/en/accounts/logout')
96
+ assert_recognizes({:controller => 'devise/sessions', :action => 'destroy', :locale => 'en'}, '/en/accounts/logout')
93
97
  end
94
98
 
95
99
  test 'map account with custom path name for password' do
96
- assert_recognizes({:controller => 'passwords', :action => 'new', :locale => 'en', :extra => 'value'}, '/en/accounts/secret/new')
100
+ assert_recognizes({:controller => 'devise/passwords', :action => 'new', :locale => 'en'}, '/en/accounts/secret/new')
97
101
  end
98
102
 
99
103
  test 'map account with custom path name for confirmation' do
100
- assert_recognizes({:controller => 'confirmations', :action => 'new', :locale => 'en', :extra => 'value'}, '/en/accounts/verification/new')
104
+ assert_recognizes({:controller => 'devise/confirmations', :action => 'new', :locale => 'en'}, '/en/accounts/verification/new')
101
105
  end
102
106
 
103
107
  test 'map account with custom path name for unlock' do
104
- assert_recognizes({:controller => 'unlocks', :action => 'new', :locale => 'en', :extra => 'value'}, '/en/accounts/unblock/new')
108
+ assert_recognizes({:controller => 'devise/unlocks', :action => 'new', :locale => 'en'}, '/en/accounts/unblock/new')
105
109
  end
106
110
 
107
111
  test 'map account with custom path name for registration' do
108
- assert_recognizes({:controller => 'registrations', :action => 'new', :locale => 'en', :extra => 'value'}, '/en/accounts/register')
109
- end
110
-
111
- test 'map deletes with :sign_out_via option' do
112
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_deletes/sign_out', :method => :delete})
113
- assert_raise ActionController::MethodNotAllowed do
114
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_deletes/sign_out', :method => :get})
115
- end
116
- end
117
-
118
- test 'map posts with :sign_out_via option' do
119
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_posts/sign_out', :method => :post})
120
- assert_raise ActionController::MethodNotAllowed do
121
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_posts/sign_out', :method => :get})
122
- end
123
- end
124
-
125
- test 'map any methods with :sign_out_via option' do
126
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_anymethods/sign_out', :method => :get})
127
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_anymethods/sign_out', :method => :post})
128
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_anymethods/sign_out', :method => :delete})
129
- assert_recognizes({:controller => 'sessions', :action => 'destroy'}, {:path => '/sign_out_via_anymethods/sign_out', :method => :put})
112
+ assert_recognizes({:controller => 'devise/registrations', :action => 'new', :locale => 'en'}, '/en/accounts/register')
130
113
  end
131
114
  end
@@ -19,19 +19,4 @@ class ActiveSupport::TestCase
19
19
  def assert_email_not_sent(&block)
20
20
  assert_no_difference('ActionMailer::Base.deliveries.size') { yield }
21
21
  end
22
-
23
- # Execute the block setting the given values and restoring old values after
24
- # the block is executed.
25
- def swap(object, new_values)
26
- old_values = {}
27
- new_values.each do |key, value|
28
- old_values[key] = object.send key
29
- object.send :"#{key}=", value
30
- end
31
- yield
32
- ensure
33
- old_values.each do |key, value|
34
- object.send :"#{key}=", value
35
- end
36
- end
37
22
  end