loyal_devise 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +14 -9
  3. data/.yardopts +9 -0
  4. data/CHANGELOG.rdoc +60 -5
  5. data/CONTRIBUTING.md +4 -2
  6. data/Gemfile +7 -7
  7. data/Gemfile.lock +107 -101
  8. data/MIT-LICENSE +1 -1
  9. data/README.md +110 -48
  10. data/Rakefile +1 -0
  11. data/app/controllers/devise/confirmations_controller.rb +2 -4
  12. data/app/controllers/devise/omniauth_callbacks_controller.rb +0 -1
  13. data/app/controllers/devise/passwords_controller.rb +16 -5
  14. data/app/controllers/devise/registrations_controller.rb +13 -7
  15. data/app/controllers/devise/sessions_controller.rb +6 -6
  16. data/app/controllers/devise/unlocks_controller.rb +3 -4
  17. data/app/controllers/devise_controller.rb +12 -33
  18. data/app/helpers/devise_helper.rb +0 -1
  19. data/app/mailers/devise/mailer.rb +7 -8
  20. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  21. data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
  22. data/app/views/devise/registrations/edit.html.erb +5 -1
  23. data/config/locales/en.yml +48 -48
  24. data/devise.gemspec +6 -6
  25. data/devise.png +0 -0
  26. data/gemfiles/{Gemfile.rails-3.1.x → Gemfile.rails-3.2.x} +8 -12
  27. data/gemfiles/Gemfile.rails-3.2.x.lock +156 -0
  28. data/lib/devise.rb +34 -11
  29. data/lib/devise/controllers/helpers.rb +33 -7
  30. data/lib/devise/controllers/rememberable.rb +6 -3
  31. data/lib/devise/controllers/scoped_views.rb +1 -2
  32. data/lib/devise/controllers/url_helpers.rb +0 -1
  33. data/lib/devise/delegator.rb +0 -1
  34. data/lib/devise/failure_app.rb +8 -2
  35. data/lib/devise/hooks/activatable.rb +1 -2
  36. data/lib/devise/hooks/forgetable.rb +0 -1
  37. data/lib/devise/hooks/lockable.rb +1 -2
  38. data/lib/devise/hooks/rememberable.rb +1 -2
  39. data/lib/devise/hooks/timeoutable.rb +0 -1
  40. data/lib/devise/hooks/trackable.rb +0 -1
  41. data/lib/devise/mailers/helpers.rb +18 -14
  42. data/lib/devise/mapping.rb +6 -7
  43. data/lib/devise/models.rb +0 -1
  44. data/lib/devise/models/authenticatable.rb +50 -27
  45. data/lib/devise/models/confirmable.rb +37 -16
  46. data/lib/devise/models/database_authenticatable.rb +17 -3
  47. data/lib/devise/models/lockable.rb +1 -2
  48. data/lib/devise/models/omniauthable.rb +1 -2
  49. data/lib/devise/models/recoverable.rb +10 -6
  50. data/lib/devise/models/registerable.rb +0 -1
  51. data/lib/devise/models/rememberable.rb +1 -2
  52. data/lib/devise/models/timeoutable.rb +1 -2
  53. data/lib/devise/models/token_authenticatable.rb +0 -1
  54. data/lib/devise/models/trackable.rb +0 -1
  55. data/lib/devise/models/validatable.rb +0 -1
  56. data/lib/devise/modules.rb +1 -2
  57. data/lib/devise/omniauth.rb +0 -1
  58. data/lib/devise/omniauth/config.rb +0 -1
  59. data/lib/devise/omniauth/url_helpers.rb +0 -1
  60. data/lib/devise/orm/active_record.rb +1 -2
  61. data/lib/devise/orm/mongoid.rb +1 -2
  62. data/lib/devise/{param_filter.rb → parameter_filter.rb} +10 -12
  63. data/lib/devise/parameter_sanitizer.rb +59 -0
  64. data/lib/devise/rails.rb +0 -1
  65. data/lib/devise/rails/routes.rb +22 -18
  66. data/lib/devise/rails/warden_compat.rb +0 -30
  67. data/lib/devise/strategies/authenticatable.rb +8 -6
  68. data/lib/devise/strategies/base.rb +1 -2
  69. data/lib/devise/strategies/database_authenticatable.rb +1 -2
  70. data/lib/devise/strategies/rememberable.rb +1 -2
  71. data/lib/devise/strategies/token_authenticatable.rb +38 -4
  72. data/lib/devise/test_helpers.rb +0 -1
  73. data/lib/devise/time_inflector.rb +1 -2
  74. data/lib/devise/version.rb +1 -2
  75. data/lib/generators/active_record/devise_generator.rb +1 -5
  76. data/lib/generators/active_record/templates/migration.rb +0 -1
  77. data/lib/generators/active_record/templates/migration_existing.rb +0 -1
  78. data/lib/generators/devise/devise_generator.rb +0 -1
  79. data/lib/generators/devise/install_generator.rb +0 -1
  80. data/lib/generators/devise/orm_helpers.rb +1 -2
  81. data/lib/generators/devise/views_generator.rb +8 -3
  82. data/lib/generators/mongoid/devise_generator.rb +1 -2
  83. data/lib/generators/templates/README +1 -1
  84. data/lib/generators/templates/devise.rb +10 -5
  85. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  86. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +1 -0
  87. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -1
  88. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +1 -0
  89. data/loyal_devise.gemspec +27 -0
  90. data/test/controllers/custom_strategy_test.rb +0 -1
  91. data/test/controllers/helpers_test.rb +0 -1
  92. data/test/controllers/internal_helpers_test.rb +13 -4
  93. data/test/controllers/passwords_controller_test.rb +32 -0
  94. data/test/controllers/sessions_controller_test.rb +28 -1
  95. data/test/controllers/url_helpers_test.rb +0 -1
  96. data/test/delegator_test.rb +0 -1
  97. data/test/devise_test.rb +12 -2
  98. data/test/failure_app_test.rb +3 -4
  99. data/test/generators/active_record_generator_test.rb +1 -4
  100. data/test/generators/devise_generator_test.rb +0 -1
  101. data/test/generators/install_generator_test.rb +0 -1
  102. data/test/generators/mongoid_generator_test.rb +0 -1
  103. data/test/generators/views_generator_test.rb +16 -2
  104. data/test/helpers/devise_helper_test.rb +1 -2
  105. data/test/integration/authenticatable_test.rb +92 -27
  106. data/test/integration/confirmable_test.rb +7 -7
  107. data/test/integration/database_authenticatable_test.rb +8 -7
  108. data/test/integration/http_authenticatable_test.rb +19 -2
  109. data/test/integration/lockable_test.rb +1 -2
  110. data/test/integration/omniauthable_test.rb +2 -3
  111. data/test/integration/recoverable_test.rb +40 -12
  112. data/test/integration/registerable_test.rb +17 -14
  113. data/test/integration/rememberable_test.rb +16 -10
  114. data/test/integration/timeoutable_test.rb +11 -2
  115. data/test/integration/token_authenticatable_test.rb +45 -2
  116. data/test/integration/trackable_test.rb +1 -2
  117. data/test/mailers/confirmation_instructions_test.rb +11 -3
  118. data/test/mailers/reset_password_instructions_test.rb +11 -3
  119. data/test/mailers/unlock_instructions_test.rb +11 -2
  120. data/test/mapping_test.rb +0 -1
  121. data/test/models/authenticatable_test.rb +6 -1
  122. data/test/models/confirmable_test.rb +53 -2
  123. data/test/models/database_authenticatable_test.rb +57 -21
  124. data/test/models/lockable_test.rb +1 -2
  125. data/test/models/omniauthable_test.rb +0 -1
  126. data/test/models/recoverable_test.rb +21 -5
  127. data/test/models/registerable_test.rb +0 -1
  128. data/test/models/rememberable_test.rb +4 -4
  129. data/test/models/serializable_test.rb +8 -8
  130. data/test/models/timeoutable_test.rb +0 -1
  131. data/test/models/token_authenticatable_test.rb +0 -1
  132. data/test/models/trackable_test.rb +0 -1
  133. data/test/models/validatable_test.rb +16 -6
  134. data/test/models_test.rb +7 -24
  135. data/test/omniauth/config_test.rb +1 -2
  136. data/test/omniauth/url_helpers_test.rb +4 -2
  137. data/test/orm/active_record.rb +1 -1
  138. data/test/orm/mongoid.rb +2 -4
  139. data/test/parameter_sanitizer_test.rb +51 -0
  140. data/test/rails_app/Rakefile +0 -4
  141. data/test/rails_app/app/active_record/admin.rb +0 -1
  142. data/test/rails_app/app/active_record/shim.rb +1 -2
  143. data/test/rails_app/app/active_record/user.rb +0 -1
  144. data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -2
  145. data/test/rails_app/app/controllers/admins_controller.rb +0 -1
  146. data/test/rails_app/app/controllers/application_controller.rb +1 -1
  147. data/test/rails_app/app/controllers/home_controller.rb +0 -1
  148. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -2
  149. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -2
  150. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +1 -2
  151. data/test/rails_app/app/controllers/users_controller.rb +8 -1
  152. data/test/rails_app/app/helpers/application_helper.rb +0 -1
  153. data/test/rails_app/app/mailers/users/mailer.rb +4 -1
  154. data/test/rails_app/app/mongoid/admin.rb +4 -3
  155. data/test/rails_app/app/mongoid/shim.rb +3 -5
  156. data/test/rails_app/app/mongoid/user.rb +2 -3
  157. data/test/rails_app/app/views/users/edit_form.html.erb +1 -0
  158. data/test/rails_app/bin/bundle +3 -0
  159. data/test/rails_app/bin/rails +4 -0
  160. data/test/rails_app/bin/rake +4 -0
  161. data/test/rails_app/config/application.rb +1 -3
  162. data/test/rails_app/config/boot.rb +3 -4
  163. data/test/rails_app/config/environment.rb +2 -3
  164. data/test/rails_app/config/environments/development.rb +23 -8
  165. data/test/rails_app/config/environments/production.rb +68 -18
  166. data/test/rails_app/config/environments/test.rb +18 -16
  167. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -1
  168. data/test/rails_app/config/initializers/devise.rb +0 -1
  169. data/test/rails_app/config/initializers/inflections.rb +0 -1
  170. data/test/rails_app/config/initializers/secret_token.rb +8 -3
  171. data/test/rails_app/config/initializers/session_store.rb +1 -0
  172. data/test/rails_app/config/routes.rb +20 -17
  173. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -1
  174. data/test/rails_app/db/schema.rb +0 -1
  175. data/test/rails_app/lib/shared_admin.rb +0 -1
  176. data/test/rails_app/lib/shared_user.rb +0 -2
  177. data/test/routes_test.rb +22 -21
  178. data/test/support/assertions.rb +0 -1
  179. data/test/support/helpers.rb +1 -2
  180. data/test/support/integration.rb +0 -1
  181. data/test/support/webrat/integrations/rails.rb +0 -1
  182. data/test/test_helper.rb +8 -2
  183. data/test/test_helpers_test.rb +0 -1
  184. data/test/test_models.rb +26 -0
  185. metadata +65 -27
  186. data/gemfiles/Gemfile.rails-3.1.x.lock +0 -167
  187. data/test/indifferent_hash.rb +0 -34
  188. data/test/rails_app/script/rails +0 -10
@@ -1,9 +1,8 @@
1
- # -*- encoding : utf-8 -*-
2
1
  unless defined?(DEVISE_ORM)
3
2
  DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
4
3
  end
5
4
 
6
- require 'rubygems'
7
- require 'bundler/setup'
5
+ # Set up gems listed in the Gemfile.
6
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
8
7
 
9
- $:.unshift File.expand_path('../../../../lib', __FILE__)
8
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,6 +1,5 @@
1
- # -*- encoding : utf-8 -*-
2
- # Load the rails application
1
+ # Load the rails application.
3
2
  require File.expand_path('../application', __FILE__)
4
3
 
5
- # Initialize the rails application
4
+ # Initialize the rails application.
6
5
  RailsApp::Application.initialize!
@@ -1,19 +1,34 @@
1
- # -*- encoding : utf-8 -*-
2
1
  RailsApp::Application.configure do
3
- # Settings specified here will take precedence over those in config/environment.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
4
3
 
5
4
  # In the development environment your application's code is reloaded on
6
- # every request. This slows down response time but is perfect for development
7
- # since you don't have to restart the webserver when you make code changes.
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
8
7
  config.cache_classes = false
9
8
 
10
- # Log error messages when you accidentally call methods on nil.
11
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
12
11
 
13
- # Show full error reports and disable caching
12
+ # Show full error reports and disable caching.
14
13
  config.consider_all_requests_local = true
15
14
  config.action_controller.perform_caching = false
16
15
 
17
- # Don't care if the mailer can't send
16
+ # Don't care if the mailer can't send.
18
17
  config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers.
23
+ config.action_dispatch.best_standards_support = :builtin
24
+
25
+ # Log the query plan for queries taking more than this (works
26
+ # with SQLite, MySQL, and PostgreSQL).
27
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
28
+
29
+ # Raise an error on page load if there are pending migrations
30
+ config.active_record.migration_error = :page_load
31
+
32
+ # Debug mode disables concatenation and preprocessing of assets.
33
+ config.assets.debug = true
19
34
  end
@@ -1,34 +1,84 @@
1
- # -*- encoding : utf-8 -*-
2
1
  RailsApp::Application.configure do
3
- # Settings specified here will take precedence over those in config/environment.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
4
3
 
5
- # The production environment is meant for finished, "live" apps.
6
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
7
5
  config.cache_classes = true
8
6
 
9
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both thread web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
10
14
  config.consider_all_requests_local = false
11
15
  config.action_controller.perform_caching = true
12
16
 
13
- # See everything in the log (default is :info)
14
- # config.log_level = :debug
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
+ # config.action_dispatch.rack_cache = true
15
21
 
16
- # Use a different logger for distributed setups
17
- # config.logger = SyslogLogger.new
22
+ # Disable Rails's static asset server (Apache or nginx will already do this).
23
+ config.serve_static_assets = false
18
24
 
19
- # Use a different cache store in production
20
- # config.cache_store = :mem_cache_store
25
+ # Compress JavaScripts and CSS.
26
+ config.assets.js_compressor = :uglifier
27
+ # config.assets.css_compressor = :sass
21
28
 
22
- # Disable Rails's static asset server
23
- # In production, Apache or nginx will already do this
24
- config.serve_static_assets = false
29
+ # Whether to fallback to assets pipeline if a precompiled asset is missed.
30
+ config.assets.compile = false
31
+
32
+ # Generate digests for assets URLs.
33
+ config.assets.digest = true
34
+
35
+ # Version of your assets, change this if you want to expire all your assets.
36
+ config.assets.version = '1.0'
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
+
42
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
+ # config.force_ssl = true
44
+
45
+ # Set to :debug to see everything in the log.
46
+ config.log_level = :info
25
47
 
26
- # Enable serving of images, stylesheets, and javascripts from an asset server
48
+ # Prepend all log lines with the following tags.
49
+ # config.log_tags = [ :subdomain, :uuid ]
50
+
51
+ # Use a different logger for distributed setups.
52
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
+
54
+ # Use a different cache store in production.
55
+ # config.cache_store = :mem_cache_store
56
+
57
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
27
58
  # config.action_controller.asset_host = "http://assets.example.com"
28
59
 
29
- # Disable delivery errors, bad email addresses will be ignored
60
+ # Precompile additional assets.
61
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
+ # config.assets.precompile += %w( search.js )
63
+
64
+ # Ignore bad email addresses and do not raise email delivery errors.
65
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
30
66
  # config.action_mailer.raise_delivery_errors = false
31
67
 
32
- # Enable threaded mode
33
- # config.threadsafe!
68
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
+ # the I18n.default_locale when a translation can not be found).
70
+ config.i18n.fallbacks = true
71
+
72
+ # Send deprecation notices to registered listeners.
73
+ config.active_support.deprecation = :notify
74
+
75
+ # Log the query plan for queries taking more than this (works
76
+ # with SQLite, MySQL, and PostgreSQL).
77
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
78
+
79
+ # Disable automatic flushing of the log to improve performance.
80
+ # config.autoflush_log = false
81
+
82
+ # Use default logging formatter so that PID and timestamp are not suppressed.
83
+ config.log_formatter = ::Logger::Formatter.new
34
84
  end
@@ -1,34 +1,36 @@
1
- # -*- encoding : utf-8 -*-
2
1
  RailsApp::Application.configure do
3
- # Settings specified here will take precedence over those in config/environment.rb
2
+ # Settings specified here will take precedence over those in config/application.rb.
4
3
 
5
4
  # The test environment is used exclusively to run your application's
6
- # test suite. You never need to work with it otherwise. Remember that
5
+ # test suite. You never need to work with it otherwise. Remember that
7
6
  # your test database is "scratch space" for the test suite and is wiped
8
- # and recreated between test runs. Don't rely on the data there!
7
+ # and recreated between test runs. Don't rely on the data there!
9
8
  config.cache_classes = true
10
9
 
11
- # Log error messages when you accidentally call methods on nil.
12
- config.whiny_nils = true
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
13
14
 
14
- # Show full error reports and disable caching
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
15
20
  config.consider_all_requests_local = true
16
21
  config.action_controller.perform_caching = false
17
22
 
18
- # Disable request forgery protection in test environment
19
- config.action_controller.allow_forgery_protection = false
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
20
28
 
21
29
  # Tell Action Mailer not to deliver emails to the real world.
22
30
  # The :test delivery method accumulates sent emails in the
23
31
  # ActionMailer::Base.deliveries array.
24
32
  config.action_mailer.delivery_method = :test
25
33
 
26
- # Use SQL instead of Active Record's schema dumper when creating the test database.
27
- # This is necessary if your schema can't be completely dumped by the schema dumper,
28
- # like if you have constraints or database-specific column types
29
- # config.active_record.schema_format = :sql
30
-
31
- config.action_dispatch.show_exceptions = false
32
-
34
+ # Print deprecation notices to the stderr.
33
35
  config.active_support.deprecation = :stderr
34
36
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  # Be sure to restart your server when you modify this file.
3
2
 
4
3
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  require "omniauth-facebook"
3
2
  require "omniauth-openid"
4
3
 
@@ -1,3 +1,2 @@
1
- # -*- encoding : utf-8 -*-
2
1
  ActiveSupport::Inflector.inflections do |inflect|
3
2
  end
@@ -1,3 +1,8 @@
1
- # -*- encoding : utf-8 -*-
2
- Rails.application.config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
3
- Rails.application.config.session_store :cookie_store, :key => "_my_app"
1
+ config = Rails.application.config
2
+
3
+ if Devise.rails4?
4
+ config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
5
+ else
6
+ config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
7
+ config.session_store :cookie_store, :key => "_my_app"
8
+ end
@@ -0,0 +1 @@
1
+ RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,9 +1,12 @@
1
- # -*- encoding : utf-8 -*-
2
1
  Rails.application.routes.draw do
3
2
  # Resources for testing
4
3
  resources :users, :only => [:index] do
5
- get :expire, :on => :member
6
- get :accept, :on => :member
4
+ member do
5
+ get :expire
6
+ get :accept
7
+ get :edit_form
8
+ put :update_form
9
+ end
7
10
 
8
11
  authenticate do
9
12
  post :exhibit, :on => :member
@@ -18,39 +21,39 @@ Rails.application.routes.draw do
18
21
  devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
19
22
 
20
23
  as :user do
21
- match "/as/sign_in", :to => "devise/sessions#new"
24
+ get "/as/sign_in", :to => "devise/sessions#new"
22
25
  end
23
26
 
24
- match "/sign_in", :to => "devise/sessions#new"
27
+ get "/sign_in", :to => "devise/sessions#new"
25
28
 
26
29
  # Admin scope
27
30
  devise_for :admin, :path => "admin_area", :controllers => { :sessions => :"admins/sessions" }, :skip => :passwords
28
31
 
29
- match "/admin_area/home", :to => "admins#index", :as => :admin_root
30
- match "/anywhere", :to => "foo#bar", :as => :new_admin_password
32
+ get "/admin_area/home", :to => "admins#index", :as => :admin_root
33
+ get "/anywhere", :to => "foo#bar", :as => :new_admin_password
31
34
 
32
35
  authenticate(:admin) do
33
- match "/private", :to => "home#private", :as => :private
36
+ get "/private", :to => "home#private", :as => :private
34
37
  end
35
38
 
36
39
  authenticate(:admin, lambda { |admin| admin.active? }) do
37
- match "/private/active", :to => "home#private", :as => :private_active
40
+ get "/private/active", :to => "home#private", :as => :private_active
38
41
  end
39
42
 
40
43
  authenticated :admin do
41
- match "/dashboard", :to => "home#admin_dashboard"
44
+ get "/dashboard", :to => "home#admin_dashboard"
42
45
  end
43
46
 
44
47
  authenticated :admin, lambda { |admin| admin.active? } do
45
- match "/dashboard/active", :to => "home#admin_dashboard"
48
+ get "/dashboard/active", :to => "home#admin_dashboard"
46
49
  end
47
50
 
48
51
  authenticated do
49
- match "/dashboard", :to => "home#user_dashboard"
52
+ get "/dashboard", :to => "home#user_dashboard"
50
53
  end
51
54
 
52
55
  unauthenticated do
53
- match "/join", :to => "home#join"
56
+ get "/join", :to => "home#join"
54
57
  end
55
58
 
56
59
  # Routes for constraints testing
@@ -93,9 +96,9 @@ Rails.application.routes.draw do
93
96
  devise_for :delete_or_posts, :sign_out_via => [:delete, :post], :class_name => "Admin"
94
97
  end
95
98
 
96
- match "/set", :to => "home#set"
97
- match "/unauthenticated", :to => "home#unauthenticated"
98
- match "/custom_strategy/new"
99
+ get "/set", :to => "home#set"
100
+ get "/unauthenticated", :to => "home#unauthenticated"
101
+ get "/custom_strategy/new"
99
102
 
100
- root :to => "home#index"
103
+ root :to => "home#index", :via => [:get, :post]
101
104
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  class CreateTables < ActiveRecord::Migration
3
2
  def self.up
4
3
  create_table :users do |t|
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  # This file is auto-generated from the current state of the database. Instead
3
2
  # of editing this file, please use the migrations feature of Active Record to
4
3
  # incrementally modify your database, and then regenerate this schema definition.
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module SharedAdmin
3
2
  extend ActiveSupport::Concern
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module SharedUser
3
2
  extend ActiveSupport::Concern
4
3
 
@@ -8,7 +7,6 @@ module SharedUser
8
7
  :trackable, :validatable, :omniauthable
9
8
 
10
9
  attr_accessor :other_key
11
- attr_accessible :username, :email, :password, :password_confirmation, :remember_me, :confirmation_sent_at
12
10
 
13
11
  # They need to be included after Devise is called.
14
12
  extend ExtendMethods
@@ -1,6 +1,7 @@
1
- # -*- encoding : utf-8 -*-
2
1
  require 'test_helper'
3
2
 
3
+ ExpectedRoutingError = Devise.rails4? ? MiniTest::Assertion : ActionController::RoutingError
4
+
4
5
  class DefaultRoutingTest < ActionController::TestCase
5
6
  test 'map new user session' do
6
7
  assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => 'users/sign_in', :method => :get})
@@ -102,7 +103,7 @@ class DefaultRoutingTest < ActionController::TestCase
102
103
  assert_recognizes({:controller => 'users/omniauth_callbacks', :action => 'google'}, {:path => 'users/auth/google/callback', :method => :post})
103
104
  assert_named_route "/users/auth/google/callback", :user_omniauth_callback_path, :google
104
105
 
105
- assert_raise ActionController::RoutingError do
106
+ assert_raise ExpectedRoutingError do
106
107
  assert_recognizes({:controller => 'ysers/omniauth_callbacks', :action => 'twitter'}, {:path => 'users/auth/twitter/callback', :method => :get})
107
108
  end
108
109
  end
@@ -124,7 +125,7 @@ class CustomizedRoutingTest < ActionController::TestCase
124
125
  end
125
126
 
126
127
  test 'does not map admin password' do
127
- assert_raise ActionController::RoutingError do
128
+ assert_raise ExpectedRoutingError do
128
129
  assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'admin_area/password/new')
129
130
  end
130
131
  end
@@ -134,7 +135,7 @@ class CustomizedRoutingTest < ActionController::TestCase
134
135
  end
135
136
 
136
137
  test 'does only map reader password' do
137
- assert_raise ActionController::RoutingError do
138
+ assert_raise ExpectedRoutingError do
138
139
  assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, 'reader/sessions/new')
139
140
  end
140
141
  assert_recognizes({:controller => 'devise/passwords', :action => 'new'}, 'reader/password/new')
@@ -162,14 +163,14 @@ class CustomizedRoutingTest < ActionController::TestCase
162
163
 
163
164
  test 'map deletes with :sign_out_via option' do
164
165
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/deletes/sign_out', :method => :delete})
165
- assert_raise ActionController::RoutingError do
166
+ assert_raise ExpectedRoutingError do
166
167
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/deletes/sign_out', :method => :get})
167
168
  end
168
169
  end
169
170
 
170
171
  test 'map posts with :sign_out_via option' do
171
172
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/posts/sign_out', :method => :post})
172
- assert_raise ActionController::RoutingError do
173
+ assert_raise ExpectedRoutingError do
173
174
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/posts/sign_out', :method => :get})
174
175
  end
175
176
  end
@@ -177,56 +178,56 @@ class CustomizedRoutingTest < ActionController::TestCase
177
178
  test 'map delete_or_posts with :sign_out_via option' do
178
179
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :post})
179
180
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :delete})
180
- assert_raise ActionController::RoutingError do
181
+ assert_raise ExpectedRoutingError do
181
182
  assert_recognizes({:controller => 'devise/sessions', :action => 'destroy'}, {:path => '/sign_out_via/delete_or_posts/sign_out', :method => :get})
182
183
  end
183
184
  end
184
-
185
+
185
186
  test 'map with constraints defined in hash' do
186
187
  assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://192.168.1.100/headquarters/sign_up', :method => :get})
187
- assert_raise ActionController::RoutingError do
188
+ assert_raise ExpectedRoutingError do
188
189
  assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://10.0.0.100/headquarters/sign_up', :method => :get})
189
190
  end
190
191
  end
191
-
192
+
192
193
  test 'map with constraints defined in block' do
193
194
  assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://192.168.1.100/homebase/sign_up', :method => :get})
194
- assert_raise ActionController::RoutingError do
195
+ assert_raise ExpectedRoutingError do
195
196
  assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => 'http://10.0.0.100//homebase/sign_up', :method => :get})
196
197
  end
197
198
  end
198
-
199
+
199
200
  test 'map with format false for sessions' do
200
201
  assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => '/htmlonly_admin/sign_in', :method => :get})
201
- assert_raise ActionController::RoutingError do
202
+ assert_raise ExpectedRoutingError do
202
203
  assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => '/htmlonly_admin/sign_in.xml', :method => :get})
203
204
  end
204
205
  end
205
-
206
+
206
207
  test 'map with format false for passwords' do
207
208
  assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => '/htmlonly_admin/password', :method => :post})
208
- assert_raise ActionController::RoutingError do
209
+ assert_raise ExpectedRoutingError do
209
210
  assert_recognizes({:controller => 'devise/passwords', :action => 'create'}, {:path => '/htmlonly_admin/password.xml', :method => :post})
210
211
  end
211
212
  end
212
-
213
+
213
214
  test 'map with format false for registrations' do
214
215
  assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => '/htmlonly_admin/sign_up', :method => :get})
215
- assert_raise ActionController::RoutingError do
216
+ assert_raise ExpectedRoutingError do
216
217
  assert_recognizes({:controller => 'devise/registrations', :action => 'new'}, {:path => '/htmlonly_admin/sign_up.xml', :method => :get})
217
218
  end
218
219
  end
219
-
220
+
220
221
  test 'map with format false for confirmations' do
221
222
  assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => '/htmlonly_users/confirmation', :method => :get})
222
- assert_raise ActionController::RoutingError do
223
+ assert_raise ExpectedRoutingError do
223
224
  assert_recognizes({:controller => 'devise/confirmations', :action => 'show'}, {:path => '/htmlonly_users/confirmation.xml', :method => :get})
224
225
  end
225
226
  end
226
-
227
+
227
228
  test 'map with format false for unlocks' do
228
229
  assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => '/htmlonly_users/unlock', :method => :get})
229
- assert_raise ActionController::RoutingError do
230
+ assert_raise ExpectedRoutingError do
230
231
  assert_recognizes({:controller => 'devise/unlocks', :action => 'show'}, {:path => '/htmlonly_users/unlock.xml', :method => :get})
231
232
  end
232
233
  end