Skip to content
This repository
Browse code

Update views generator and now have scoped views.

  • Loading branch information...
commit 02e8c04cdef6d1a8da763415b4cf042759ba5f44 1 parent 5bf2eb3
José Valim josevalim authored

Showing 36 changed files with 134 additions and 145 deletions. Show diff stats Hide diff stats

  1. +7 1 CHANGELOG.rdoc
  2. +1 1  README.rdoc
  3. +1 1  app/controllers/{ → devise}/confirmations_controller.rb
  4. +1 1  app/controllers/{ → devise}/passwords_controller.rb
  5. +1 1  app/controllers/{ → devise}/registrations_controller.rb
  6. +1 1  app/controllers/{ → devise}/sessions_controller.rb
  7. +1 1  app/controllers/{ → devise}/unlocks_controller.rb
  8. +11 24 app/models/{devise_mailer.rb → devise/mailer.rb}
  9. +1 1  app/views/{ → devise}/confirmations/new.html.erb
  10. 0  app/views/{devise_mailer → devise/mailer}/confirmation_instructions.html.erb
  11. 0  app/views/{devise_mailer → devise/mailer}/reset_password_instructions.html.erb
  12. 0  app/views/{devise_mailer → devise/mailer}/unlock_instructions.html.erb
  13. +1 1  app/views/{ → devise}/passwords/edit.html.erb
  14. +1 1  app/views/{ → devise}/passwords/new.html.erb
  15. +1 1  app/views/{ → devise}/registrations/edit.html.erb
  16. +1 1  app/views/{ → devise}/registrations/new.html.erb
  17. +1 1  app/views/{ → devise}/sessions/new.html.erb
  18. 0  app/views/{ → devise}/shared/_devise_links.erb
  19. +1 1  app/views/{ → devise}/unlocks/new.html.erb
  20. +0 3  generators/devise_views/USAGE
  21. +0 21 generators/devise_views/devise_views_generator.rb
  22. +1 0  lib/devise.rb
  23. +9 34 lib/devise/controllers/internal_helpers.rb
  24. +35 0 lib/devise/controllers/scoped_views.rb
  25. +1 1  lib/devise/models/confirmable.rb
  26. +1 1  lib/devise/models/lockable.rb
  27. +1 1  lib/devise/models/recoverable.rb
  28. +11 11 lib/devise/rails/routes.rb
  29. +1 1  lib/devise/strategies/authenticatable.rb
  30. +11 0 lib/generators/devise_views/devise_views_generator.rb
  31. +3 3 test/integration/authenticatable_test.rb
  32. +2 2 test/mailers/confirmation_instructions_test.rb
  33. 0  test/rails_app/app/views/{devise_mailer/users → users/mailer}/confirmation_instructions.erb
  34. 0  test/rails_app/app/views/{sessions/users → users/sessions}/new.html.erb
  35. +1 3 test/rails_app/config/routes.rb
  36. +26 26 test/routes_test.rb
8 CHANGELOG.rdoc
Source Rendered
... ... @@ -1,6 +1,12 @@
1 1 == 1.1.0
2 2
3   -* Rails 3 compatibility
  3 +* enhancements
  4 + * Rails 3 compatibility.
  5 + * All controllers and views are namespaced, for example: Devise::SessionsController and "devise/sessions".
  6 +
  7 +* deprecations
  8 + * Rails 3 compatible only.
  9 + * The scoped views are no longer "sessions/users/new". Now use "users/sessions/new".
4 10
5 11 == 1.0.1
6 12
2  README.rdoc
Source Rendered
@@ -175,7 +175,7 @@ Since devise is an engine, it has all default views inside the gem. They are goo
175 175
176 176 By default Devise will use the same views for all roles you have. But what if you need so different views to each of them? Devise also has an easy way to accomplish it: just setup config.scoped_views to true inside "config/initializers/devise.rb".
177 177
178   -After doing so you will be able to have views based on the scope like 'sessions/users/new' and 'sessions/admin/new'. If no view is found within the scope, Devise will fallback to the default view.
  178 +After doing so you will be able to have views based on the scope like 'users/sessions/new' and 'admin/sessions/new'. If no view is found within the scope, Devise will fallback to the default view.
179 179
180 180 Devise uses flash messages to let users know if their login is successful or not. Devise expects your application to call 'flash[:notice]' and 'flash[:alert]' as appropriate.
181 181
2  app/controllers/confirmations_controller.rb → app/controllers/devise/confirmations_controller.rb
... ... @@ -1,4 +1,4 @@
1   -class ConfirmationsController < ApplicationController
  1 +class Devise::ConfirmationsController < ApplicationController
2 2 include Devise::Controllers::InternalHelpers
3 3
4 4 # GET /resource/confirmation/new
2  app/controllers/passwords_controller.rb → app/controllers/devise/passwords_controller.rb
... ... @@ -1,4 +1,4 @@
1   -class PasswordsController < ApplicationController
  1 +class Devise::PasswordsController < ApplicationController
2 2 include Devise::Controllers::InternalHelpers
3 3
4 4 before_filter :require_no_authentication
2  app/controllers/registrations_controller.rb → app/controllers/devise/registrations_controller.rb
... ... @@ -1,4 +1,4 @@
1   -class RegistrationsController < ApplicationController
  1 +class Devise::RegistrationsController < ApplicationController
2 2 include Devise::Controllers::InternalHelpers
3 3
4 4 before_filter :require_no_authentication, :only => [ :new, :create ]
2  app/controllers/sessions_controller.rb → app/controllers/devise/sessions_controller.rb
... ... @@ -1,4 +1,4 @@
1   -class SessionsController < ApplicationController
  1 +class Devise::SessionsController < ApplicationController
2 2 include Devise::Controllers::InternalHelpers
3 3
4 4 before_filter :require_no_authentication, :only => [ :new, :create ]
2  app/controllers/unlocks_controller.rb → app/controllers/devise/unlocks_controller.rb
... ... @@ -1,4 +1,4 @@
1   -class UnlocksController < ApplicationController
  1 +class Devise::UnlocksController < ApplicationController
2 2 include Devise::Controllers::InternalHelpers
3 3
4 4 # GET /resource/unlock/new
35 app/models/devise_mailer.rb → app/models/devise/mailer.rb
... ... @@ -1,13 +1,12 @@
1   -class DeviseMailer < ::ActionMailer::Base
2   - extend Devise::Controllers::InternalHelpers::ScopedViews
  1 +class Devise::Mailer < ::ActionMailer::Base
  2 + include Devise::Controllers::ScopedViews
  3 +
  4 + attr_reader :devise_mapping, :resource
3 5
4   - # Deliver confirmation instructions when the user is created or its email is
5   - # updated, and also when confirmation is manually requested
6 6 def confirmation_instructions(record)
7 7 setup_mail(record, :confirmation_instructions)
8 8 end
9 9
10   - # Deliver reset password instructions when manually requested
11 10 def reset_password_instructions(record)
12 11 setup_mail(record, :reset_password_instructions)
13 12 end
@@ -19,27 +18,15 @@ def unlock_instructions(record)
19 18 private
20 19
21 20 # Configure default email options
22   - def setup_mail(record, key)
23   - mapping = Devise::Mapping.find_by_class(record.class)
24   - raise "Invalid devise resource #{record}" unless mapping
  21 + def setup_mail(record, action)
  22 + @devise_mapping = Devise::Mapping.find_by_class(record.class)
25 23
26   - @resource = instance_variable_set("@#{mapping.name}", record)
  24 + raise "Invalid devise resource #{record}" unless @devise_mapping
  25 + @resource = instance_variable_set("@#{@devise_mapping.name}", record)
27 26
28   - mail(:subject => translate(mapping, key), :from => mailer_sender(mapping),
29   - :to => record.email) do |format|
30   - format.html { render_with_scope(key, mapping) }
31   - end
32   - end
33   -
34   - def render_with_scope(key, mapping)
35   - if self.class.scoped_views
36   - begin
37   - render :template => "devise_mailer/#{mapping.as}/#{key}"
38   - rescue ActionView::MissingTemplate
39   - render :template => "devise_mailer/#{key}"
40   - end
41   - else
42   - render :template => "devise_mailer/#{key}"
  27 + mail(:subject => translate(@devise_mapping, action),
  28 + :from => mailer_sender(@devise_mapping), :to => record.email) do |format|
  29 + format.html { render_with_scope(action, :controller => "mailer") }
43 30 end
44 31 end
45 32
2  app/views/confirmations/new.html.erb → app/views/devise/confirmations/new.html.erb
@@ -9,4 +9,4 @@
9 9 <p><%= f.submit "Resend confirmation instructions" %></p>
10 10 <% end %>
11 11
12   -<%= render :partial => "shared/devise_links" %>
  12 +<%= render :partial => "devise/shared/devise_links" %>
0  .../devise_mailer/confirmation_instructions.html.erb → .../devise/mailer/confirmation_instructions.html.erb
File renamed without changes
0  ...evise_mailer/reset_password_instructions.html.erb → ...evise/mailer/reset_password_instructions.html.erb
File renamed without changes
0  app/views/devise_mailer/unlock_instructions.html.erb → app/views/devise/mailer/unlock_instructions.html.erb
File renamed without changes
2  app/views/passwords/edit.html.erb → app/views/devise/passwords/edit.html.erb
@@ -13,4 +13,4 @@
13 13 <p><%= f.submit "Change my password" %></p>
14 14 <% end %>
15 15
16   -<%= render :partial => "shared/devise_links" %>
  16 +<%= render :partial => "devise/shared/devise_links" %>
2  app/views/passwords/new.html.erb → app/views/devise/passwords/new.html.erb
@@ -9,4 +9,4 @@
9 9 <p><%= f.submit "Send me reset password instructions" %></p>
10 10 <% end %>
11 11
12   -<%= render :partial => "shared/devise_links" %>
  12 +<%= render :partial => "devise/shared/devise_links" %>
2  app/views/registrations/edit.html.erb → app/views/devise/registrations/edit.html.erb
@@ -22,4 +22,4 @@
22 22
23 23 <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
24 24
25   -<%= render :partial => "shared/devise_links" %>
  25 +<%= link_to "Back", :back %>
2  app/views/registrations/new.html.erb → app/views/devise/registrations/new.html.erb
@@ -14,4 +14,4 @@
14 14 <p><%= f.submit "Sign up" %></p>
15 15 <% end -%>
16 16
17   -<%= render :partial => "shared/devise_links" %>
  17 +<%= render :partial => "devise/shared/devise_links" %>
2  app/views/sessions/new.html.erb → app/views/devise/sessions/new.html.erb
@@ -14,4 +14,4 @@
14 14 <p><%= f.submit "Sign in" %></p>
15 15 <% end -%>
16 16
17   -<%= render :partial => "shared/devise_links" %>
  17 +<%= render :partial => "devise/shared/devise_links" %>
0  app/views/shared/_devise_links.erb → app/views/devise/shared/_devise_links.erb
File renamed without changes
2  app/views/unlocks/new.html.erb → app/views/devise/unlocks/new.html.erb
@@ -9,4 +9,4 @@
9 9 <p><%= f.submit "Resend unlock instructions" %></p>
10 10 <% end %>
11 11
12   -<%= render :partial => "shared/devise_links" %>
  12 +<%= render :partial => "devise/shared/devise_links" %>
3  generators/devise_views/USAGE
... ... @@ -1,3 +0,0 @@
1   -To copy all session, password, confirmation and mailer views from devise to your app just run the following command:
2   -
3   - script/generate devise_views
21 generators/devise_views/devise_views_generator.rb
... ... @@ -1,21 +0,0 @@
1   -class DeviseViewsGenerator < Rails::Generator::Base
2   -
3   - def initialize(*args)
4   - super
5   - @source_root = options[:source] || File.join(spec.path, '..', '..')
6   - end
7   -
8   - def manifest
9   - record do |m|
10   - m.directory "app/views"
11   -
12   - Dir[File.join(@source_root, "app", "views", "**/*.erb")].each do |file|
13   - file = file.gsub(@source_root, "")[1..-1]
14   -
15   - m.directory File.dirname(file)
16   - m.file file, file
17   - end
18   - end
19   - end
20   -
21   -end
1  lib/devise.rb
@@ -6,6 +6,7 @@ module Devise
6 6 module Controllers
7 7 autoload :Helpers, 'devise/controllers/helpers'
8 8 autoload :InternalHelpers, 'devise/controllers/internal_helpers'
  9 + autoload :ScopedViews, 'devise/controllers/scoped_views'
9 10 autoload :UrlHelpers, 'devise/controllers/url_helpers'
10 11 end
11 12
43 lib/devise/controllers/internal_helpers.rb
@@ -4,27 +4,18 @@ module Controllers
4 4 # included in ApplicationController since they all depend on the url being
5 5 # accessed.
6 6 module InternalHelpers #:nodoc:
  7 + extend ActiveSupport::Concern
  8 + include Devise::Controllers::ScopedViews
7 9
8   - def self.included(base)
9   - base.class_eval do
10   - extend ScopedViews
  10 + included do
  11 + helpers = [:resource, :scope_name, :resource_name,
  12 + :resource_class, :devise_mapping, :devise_controller?]
11 13
12   - helper_method :resource, :scope_name, :resource_name, :resource_class, :devise_mapping, :devise_controller?
13   - hide_action :resource, :scope_name, :resource_name, :resource_class, :devise_mapping, :devise_controller?
  14 + hide_action *helpers
  15 + helper_method *helpers
14 16
15   - skip_before_filter *Devise.mappings.keys.map { |m| :"authenticate_#{m}!" }
16   - before_filter :is_devise_resource?
17   - end
18   - end
19   -
20   - module ScopedViews
21   - def scoped_views
22   - defined?(@scoped_views) ? @scoped_views : Devise.scoped_views
23   - end
24   -
25   - def scoped_views=(value)
26   - @scoped_views = value
27   - end
  17 + before_filter :is_devise_resource?
  18 + skip_before_filter *Devise.mappings.keys.map { |m| :"authenticate_#{m}!" }
28 19 end
29 20
30 21 # Gets the actual resource stored in the instance variable
@@ -107,22 +98,6 @@ def set_now_flash_message(key, kind)
107 98 set_flash_message(key, kind, true)
108 99 end
109 100
110   - # Render a view for the specified scope. Turned off by default.
111   - # Accepts just :controller as option.
112   - def render_with_scope(action, options={})
113   - controller_name = options.delete(:controller) || self.controller_name
114   -
115   - if self.class.scoped_views
116   - begin
117   - render :template => "#{controller_name}/#{devise_mapping.as}/#{action}"
118   - rescue ActionView::MissingTemplate
119   - render :template => "#{controller_name}/#{action}"
120   - end
121   - else
122   - render :template => "#{controller_name}/#{action}"
123   - end
124   - end
125   -
126 101 end
127 102 end
128 103 end
35 lib/devise/controllers/scoped_views.rb
... ... @@ -0,0 +1,35 @@
  1 +module Devise
  2 + module Controllers
  3 + module ScopedViews
  4 + extend ActiveSupport::Concern
  5 +
  6 + module ClassMethods
  7 + def scoped_views
  8 + defined?(@scoped_views) ? @scoped_views : Devise.scoped_views
  9 + end
  10 +
  11 + def scoped_views=(value)
  12 + @scoped_views = value
  13 + end
  14 + end
  15 +
  16 + protected
  17 +
  18 + # Render a view for the specified scope. Turned off by default.
  19 + # Accepts just :controller as option.
  20 + def render_with_scope(action, options={})
  21 + controller_name = options.delete(:controller) || self.controller_name
  22 +
  23 + if self.class.scoped_views
  24 + begin
  25 + render :template => "#{devise_mapping.as}/#{controller_name}/#{action}"
  26 + rescue ActionView::MissingTemplate
  27 + render :template => "#{controller_path}/#{action}"
  28 + end
  29 + else
  30 + render :template => "#{controller_path}/#{action}"
  31 + end
  32 + end
  33 + end
  34 + end
  35 +end
2  lib/devise/models/confirmable.rb
@@ -57,7 +57,7 @@ def confirmed?
57 57
58 58 # Send confirmation instructions by email
59 59 def send_confirmation_instructions
60   - ::DeviseMailer.confirmation_instructions(self).deliver
  60 + ::Devise::Mailer.confirmation_instructions(self).deliver
61 61 end
62 62
63 63 # Remove confirmation date and send confirmation instructions, to ensure
2  lib/devise/models/lockable.rb
@@ -58,7 +58,7 @@ def locked?
58 58
59 59 # Send unlock instructions by email
60 60 def send_unlock_instructions
61   - ::DeviseMailer.unlock_instructions(self).deliver
  61 + ::Devise::Mailer.unlock_instructions(self).deliver
62 62 end
63 63
64 64 # Resend the unlock instructions if the user is locked.
2  lib/devise/models/recoverable.rb
@@ -32,7 +32,7 @@ def reset_password!(new_password, new_password_confirmation)
32 32 # Resets reset password token and send reset password instructions by email
33 33 def send_reset_password_instructions
34 34 generate_reset_password_token!
35   - ::DeviseMailer.reset_password_instructions(self).deliver
  35 + ::Devise::Mailer.reset_password_instructions(self).deliver
36 36 end
37 37
38 38 protected
22 lib/devise/rails/routes.rb
@@ -96,35 +96,35 @@ def devise_for(*resources)
96 96 protected
97 97
98 98 def authenticatable(mapping)
99   - scope(mapping.raw_path) do
100   - get mapping.path_names[:sign_in], :to => "sessions#new", :as => :"new_#{mapping.name}_session"
101   - post mapping.path_names[:sign_in], :to => "sessions#create", :as => :"#{mapping.name}_session"
102   - get mapping.path_names[:sign_out], :to => "sessions#destroy", :as => :"destroy_#{mapping.name}_session"
  99 + scope mapping.raw_path do
  100 + get mapping.path_names[:sign_in], :to => "devise/sessions#new", :as => :"new_#{mapping.name}_session"
  101 + post mapping.path_names[:sign_in], :to => "devise/sessions#create", :as => :"#{mapping.name}_session"
  102 + get mapping.path_names[:sign_out], :to => "devise/sessions#destroy", :as => :"destroy_#{mapping.name}_session"
103 103 end
104 104 end
105 105
106 106 def recoverable(mapping)
107   - scope(mapping.raw_path, :name_prefix => mapping.name) do
108   - resource :password, :only => [:new, :create, :edit, :update], :as => mapping.path_names[:password]
  107 + scope mapping.raw_path, :name_prefix => mapping.name do
  108 + resource :password, :only => [:new, :create, :edit, :update], :as => mapping.path_names[:password], :controller => "devise/passwords"
109 109 end
110 110 end
111 111
112 112 def confirmable(mapping)
113   - scope(mapping.raw_path, :name_prefix => mapping.name) do
114   - resource :confirmation, :only => [:new, :create, :show], :as => mapping.path_names[:confirmation]
  113 + scope mapping.raw_path, :name_prefix => mapping.name do
  114 + resource :confirmation, :only => [:new, :create, :show], :as => mapping.path_names[:confirmation], :controller => "devise/confirmations"
115 115 end
116 116 end
117 117
118 118 def lockable(mapping)
119   - scope(mapping.raw_path, :name_prefix => mapping.name) do
120   - resource :unlock, :only => [:new, :create, :show], :as => mapping.path_names[:unlock]
  119 + scope mapping.raw_path, :name_prefix => mapping.name do
  120 + resource :unlock, :only => [:new, :create, :show], :as => mapping.path_names[:unlock], :controller => "devise/unlocks"
121 121 end
122 122 end
123 123
124 124 def registerable(mapping)
125 125 scope :name_prefix => mapping.name do
126 126 resource :registration, :only => [:new, :create, :edit, :update, :destroy], :as => mapping.raw_path[1..-1],
127   - :path_names => { :new => mapping.path_names[:sign_up] }
  127 + :path_names => { :new => mapping.path_names[:sign_up] }, :controller => "devise/registrations"
128 128 end
129 129 end
130 130 end
2  lib/devise/strategies/authenticatable.rb
@@ -23,7 +23,7 @@ def authenticate!
23 23 protected
24 24
25 25 def valid_controller?
26   - params[:controller] == 'sessions'
  26 + params[:controller] =~ /sessions$/
27 27 end
28 28
29 29 def valid_params?
11 lib/generators/devise_views/devise_views_generator.rb
... ... @@ -0,0 +1,11 @@
  1 +class DeviseViewsGenerator < Rails::Generators::Base
  2 + desc "Copies all Devise views to your application."
  3 +
  4 + def self.source_root
  5 + @_devise_source_root ||= File.expand_path("../../../../app/views", __FILE__)
  6 + end
  7 +
  8 + def copy_views
  9 + directory "devise"
  10 + end
  11 +end
6 test/integration/authenticatable_test.rb
@@ -221,15 +221,15 @@ class AuthenticationTest < ActionController::IntegrationTest
221 221
222 222 test 'renders the scoped view if turned on in an specific controller' do
223 223 begin
224   - SessionsController.scoped_views = true
  224 + Devise::SessionsController.scoped_views = true
225 225 assert_raise Webrat::NotFoundError do
226 226 sign_in_as_user
227 227 end
228 228
229 229 assert_match /Special user view/, response.body
230   - assert !PasswordsController.scoped_views
  230 + assert !Devise::PasswordsController.scoped_views
231 231 ensure
232   - SessionsController.send :remove_instance_variable, :@scoped_views
  232 + Devise::SessionsController.send :remove_instance_variable, :@scoped_views
233 233 end
234 234 end
235 235
4 test/mailers/confirmation_instructions_test.rb
@@ -65,10 +65,10 @@ def mail
65 65
66 66 test 'renders a scoped if scoped_views is set in the mailer class' do
67 67 begin
68   - DeviseMailer.scoped_views = true
  68 + Devise::Mailer.scoped_views = true
69 69 assert_equal user.email, mail.body.decoded
70 70 ensure
71   - DeviseMailer.send :remove_instance_variable, :@scoped_views
  71 + Devise::Mailer.send :remove_instance_variable, :@scoped_views
72 72 end
73 73 end
74 74
0  ...devise_mailer/users/confirmation_instructions.erb → .../views/users/mailer/confirmation_instructions.erb
File renamed without changes
0  test/rails_app/app/views/sessions/users/new.html.erb → test/rails_app/app/views/users/sessions/new.html.erb
File renamed without changes
4 test/rails_app/config/routes.rb
@@ -15,8 +15,6 @@
15 15 resources :admins, :only => [:index]
16 16 root :to => "home#index"
17 17
18   - match '/admin_area/password/new', :to => "passwords#new"
19 18 match '/admin_area/home', :to => "admins#index", :as => :admin_root
20   -
21   - match '/sign_in', :to => "sessions#new"
  19 + match '/sign_in', :to => "devise/sessions#new"
22 20 end
52 test/routes_test.rb
@@ -3,108 +3,108 @@
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 77 test 'map admin session with :as option' do
78   - assert_recognizes({:controller => 'sessions', :action => 'new'}, {:path => 'admin_area/sign_in', :method => :get})
  78 + assert_recognizes({:controller => 'devise/sessions', :action => 'new'}, {:path => 'admin_area/sign_in', :method => :get})
79 79 end
80 80
81 81 test 'does not map admin confirmation' do
82 82 assert_raise ActionController::RoutingError do
83   - assert_recognizes({:controller => 'confirmations', :action => 'new'}, 'admin_area/confirmation/new')
  83 + assert_recognizes({:controller => 'devise/confirmations', :action => 'new'}, 'admin_area/confirmation/new')
84 84 end
85 85 end
86 86
87 87 test 'map account with custom path name for session sign in' do
88   - assert_recognizes({:controller => 'sessions', :action => 'new', :locale => 'en'}, '/en/accounts/login')
  88 + assert_recognizes({:controller => 'devise/sessions', :action => 'new', :locale => 'en'}, '/en/accounts/login')
89 89 end
90 90
91 91 test 'map account with custom path name for session sign out' do
92   - assert_recognizes({:controller => 'sessions', :action => 'destroy', :locale => 'en'}, '/en/accounts/logout')
  92 + assert_recognizes({:controller => 'devise/sessions', :action => 'destroy', :locale => 'en'}, '/en/accounts/logout')
93 93 end
94 94
95 95 test 'map account with custom path name for password' do
96   - assert_recognizes({:controller => 'passwords', :action => 'new', :locale => 'en'}, '/en/accounts/secret/new')
  96 + assert_recognizes({:controller => 'devise/passwords', :action => 'new', :locale => 'en'}, '/en/accounts/secret/new')
97 97 end
98 98
99 99 test 'map account with custom path name for confirmation' do
100   - assert_recognizes({:controller => 'confirmations', :action => 'new', :locale => 'en'}, '/en/accounts/verification/new')
  100 + assert_recognizes({:controller => 'devise/confirmations', :action => 'new', :locale => 'en'}, '/en/accounts/verification/new')
101 101 end
102 102
103 103 test 'map account with custom path name for unlock' do
104   - assert_recognizes({:controller => 'unlocks', :action => 'new', :locale => 'en'}, '/en/accounts/unblock/new')
  104 + assert_recognizes({:controller => 'devise/unlocks', :action => 'new', :locale => 'en'}, '/en/accounts/unblock/new')
105 105 end
106 106
107 107 test 'map account with custom path name for registration' do
108   - assert_recognizes({:controller => 'registrations', :action => 'new', :locale => 'en'}, '/en/accounts/register')
  108 + assert_recognizes({:controller => 'devise/registrations', :action => 'new', :locale => 'en'}, '/en/accounts/register')
109 109 end
110 110 end

0 comments on commit 02e8c04

Please sign in to comment.
Something went wrong with that request. Please try again.