tb_core 1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +8 -8
  2. data/app/controllers/spud/admin/application_controller.rb +2 -2
  3. data/app/controllers/spud/{password_resets_controller.rb → admin/password_resets_controller.rb} +13 -11
  4. data/app/controllers/spud/admin/settings_controller.rb +27 -0
  5. data/app/controllers/spud/{user_sessions_controller.rb → admin/user_sessions_controller.rb} +13 -7
  6. data/app/controllers/spud/application_controller.rb +61 -61
  7. data/app/controllers/spud/setup_controller.rb +2 -2
  8. data/app/mailers/spud/core_mailer.rb +1 -1
  9. data/app/views/layouts/spud/admin/application.html.erb +3 -2
  10. data/app/views/spud/{password_resets/new.html.erb → admin/password_resets/index.html.erb} +1 -1
  11. data/app/views/spud/{password_resets/edit.html.erb → admin/password_resets/show.html.erb} +3 -3
  12. data/app/views/spud/{users → admin/settings}/_form.html.erb +1 -1
  13. data/app/views/spud/admin/settings/edit.html.erb +8 -0
  14. data/app/views/spud/{user_sessions → admin/user_sessions}/new.html.erb +3 -3
  15. data/config/routes.rb +24 -15
  16. data/lib/spud_core/configuration.rb +6 -1
  17. data/lib/spud_core/version.rb +1 -1
  18. data/spec/controllers/spud/admin/application_controller_spec.rb +1 -1
  19. data/spec/controllers/spud/{password_reset_controller_spec.rb → admin/password_reset_controller_spec.rb} +11 -11
  20. data/spec/controllers/spud/{users_controller_spec.rb → admin/settings_controller_spec.rb} +5 -19
  21. data/spec/controllers/spud/{user_sessions_controller_spec.rb → admin/user_sessions_controller_spec.rb} +7 -7
  22. data/spec/controllers/spud/setup_controller_spec.rb +2 -2
  23. data/spec/dummy/log/test.log +34192 -0
  24. metadata +16 -16
  25. data/app/controllers/spud/users_controller.rb +0 -45
  26. data/app/views/spud/users/settings.html.erb +0 -12
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWM5YTRhNTM2YjJkYzEwMzAxMDhmN2EyOGY4ZTljY2Y0ZDE4Y2VlYw==
4
+ ZTFjY2Q4M2YxNThlMzRjNTVlNDRkYzYyMGM2OTY5NDI1ZGE1ZWY1Ng==
5
5
  data.tar.gz: !binary |-
6
- MjBjMTgxNTVlNjhjNGUxMDAzNDcyOWZlMjQ2YjJlZTBkYmE4NDc5Mw==
6
+ OTlhNWEzZGU5MGExMWQ5OTM5ZmJjMTExNTE0YTk3ZWMwN2NmOWQ4Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- M2ZiOWUzYmRlMmRmMzJmZGZmMzk5NjFjMjlhNTIwODdjZjllMzg4YTdjZDkw
10
- NGU4N2RkOTUzY2Y3NWQyZDA1ZTk4YjRiMGQ5OTMxZDVmNmNiM2UxMWZiNDdh
11
- NzhiYWNiOTgyZTY4ZTFhNWU5YzkyMWY5Mjk4MDE5OWE5OGUxOWI=
9
+ ODYyOTM4NWQ4NTI1NzUzMjYyYzkxMzVjYTA5YzAxZjBjNDM3MzMyODVlZTg4
10
+ YTFhZmE0OTEyOWE0ZTI3MDEwYzYxZTE2NjZhOGIxMjg1M2JlZGY5OTQ3Mzk5
11
+ YzdjMzNkYzkzOGU4OTQyY2Y1MGI1ODU5M2JlZGM5NzMwMTk1MGM=
12
12
  data.tar.gz: !binary |-
13
- MTJmYWYyYTZhYzdjMWI5Nzc0ZmQxZjExN2M5YTFhNWVhZDI3NTgyMGQyNDA3
14
- ZThlNjQxYWE2MGI0ZTFjOTJiMjZlNjRlNmIwNDg3YTBmMjEwNjZhNTY0ZDQx
15
- YTRiYTA5MzA2NWM3MTIyOWE2NjE3M2RjMDdhZDE0ZjQ1YzNkMjk=
13
+ ZTE0ZjY4NTBhMTFhOWFlMzBmMDU2ODAwZDUxNDRlZmM5OTgxYzE4ZjAxODI2
14
+ NjM4NDFiN2RlNDc4ZWMyODIyMWQ4ODY0MzlkMTA3ZGNjZDMxZDgwNWNmY2Yw
15
+ ZDY1NjJjOTZmZjkyMjA0NGNiZDA0NzljNzQ1YmQ0N2I1ZTg1MGU=
@@ -31,8 +31,8 @@ private
31
31
  if !@current_user.super_admin && current_user_permissions.count == 0
32
32
  store_location
33
33
  flash[:error] = "User must be an administrator to view this area."
34
- redirect_to root_url
35
- end
34
+ redirect_to root_path
35
+ end
36
36
  return true
37
37
  end
38
38
 
@@ -1,11 +1,12 @@
1
- class Spud::PasswordResetsController < Spud::ApplicationController
1
+ class Spud::Admin::PasswordResetsController < Spud::ApplicationController
2
+
2
3
  before_filter :require_no_user, :only => [:new, :create]
3
- before_filter :load_user_using_perishable_token, :only => [:edit, :update]
4
+ before_filter :load_user_using_perishable_token, :only => [:show, :update]
4
5
 
5
6
  layout 'spud/login/application'
6
7
 
7
- def new
8
- render
8
+ def index
9
+
9
10
  end
10
11
 
11
12
  def create
@@ -14,15 +15,15 @@ class Spud::PasswordResetsController < Spud::ApplicationController
14
15
  Spud::CoreMailer.forgot_password_notification(@user).deliver
15
16
  flash[:notice] = "Instructions to reset your password have been emailed to you. " +
16
17
  "Please check your email."
17
- redirect_to new_spud_user_session_url
18
+ redirect_to spud_admin_login_path
18
19
  else
19
20
  flash[:notice] = "No user was found with that email address"
20
- render :action => :new
21
+ render 'index'
21
22
  end
22
23
  end
23
24
 
24
- def edit
25
- render
25
+ def show
26
+
26
27
  end
27
28
 
28
29
  def update
@@ -30,13 +31,14 @@ class Spud::PasswordResetsController < Spud::ApplicationController
30
31
  @user.password_confirmation = params[:spud_user][:password_confirmation]
31
32
  if @user.save
32
33
  flash[:notice] = "Password successfully updated"
33
- redirect_to new_spud_user_session_url
34
+ redirect_to spud_admin_login_path
34
35
  else
35
- render :action => :edit
36
+ render 'show'
36
37
  end
37
38
  end
38
39
 
39
40
  private
41
+
40
42
  def load_user_using_perishable_token
41
43
  @user = SpudUser.find_using_perishable_token(params[:id])
42
44
  unless @user
@@ -44,7 +46,7 @@ private
44
46
  "If you are having issues try copying and pasting the URL " +
45
47
  "from your email into your browser or restarting the " +
46
48
  "reset password process."
47
- redirect_to new_spud_user_session_url
49
+ redirect_to spud_admin_login_path
48
50
  end
49
51
  end
50
52
  end
@@ -0,0 +1,27 @@
1
+ class Spud::Admin::SettingsController < Spud::ApplicationController
2
+ before_filter :require_user
3
+ layout 'spud/admin/detail'
4
+
5
+ def edit
6
+ if current_user.has_admin_rights?
7
+ add_breadcrumb "Dashboard", :spud_admin_root_path
8
+ end
9
+ add_breadcrumb "Settings", :spud_admin_settings_path
10
+ @page_thumbnail = "spud/admin/users_thumb.png"
11
+ @page_name = "Settings"
12
+ end
13
+
14
+ def update
15
+ add_breadcrumb "Settings", :spud_admin_settings_path
16
+ @page_thumbnail = "spud/admin/users_thumb.png"
17
+ @page_name = "Settings"
18
+ if @current_user.update_attributes(params[:spud_user].slice :login,:first_name,:last_name,:email,:password,:password_confirmation,:time_zone)
19
+ flash[:notice] = "User settings saved successfully."
20
+ redirect_to spud_admin_root_path
21
+ else
22
+ flash[:error] = "There was an error while saving your settings."
23
+ render 'edit'
24
+ end
25
+ end
26
+
27
+ end
@@ -1,13 +1,15 @@
1
- class Spud::UserSessionsController < Spud::ApplicationController
2
- before_filter :require_no_user, :only => [:new, :create]
1
+ class Spud::Admin::UserSessionsController < Spud::ApplicationController
2
+
3
3
  before_filter :require_user, :only => :destroy
4
4
  layout 'spud/login/application'
5
+
5
6
  def new
6
- if SpudUser.all.count == 0
7
+ if current_user
8
+ redirect_to spud_admin_root_path
9
+ elsif SpudUser.all.count == 0
7
10
  logger.debug "NO USERS!"
8
11
  redirect_to spud_setup_url() and return
9
12
  end
10
-
11
13
  @user_session = SpudUserSession.new
12
14
  end
13
15
 
@@ -15,7 +17,7 @@ class Spud::UserSessionsController < Spud::ApplicationController
15
17
  @user_session = SpudUserSession.new(params[:spud_user_session])
16
18
  if @user_session.save
17
19
  flash[:notice] = "Login successful!"
18
- redirect_back_or_default spud_admin_root_path
20
+ redirect_to spud_admin_root_path
19
21
  else
20
22
  render :action => :new
21
23
  end
@@ -27,7 +29,11 @@ class Spud::UserSessionsController < Spud::ApplicationController
27
29
  if !request.referer.blank?
28
30
  session[:return_to] = request.referer
29
31
  end
30
- redirect_back_or_default new_spud_user_session_url
31
-
32
+ redirect_back_or_default spud_admin_login_path
32
33
  end
34
+
35
+ def legacy_redirect
36
+ redirect_to spud_admin_login_path
37
+ end
38
+
33
39
  end
@@ -1,4 +1,5 @@
1
1
  class Spud::ApplicationController < ActionController::Base
2
+
2
3
  unloadable
3
4
  protect_from_forgery
4
5
  helper_method :current_user_session, :current_user
@@ -8,82 +9,81 @@ class Spud::ApplicationController < ActionController::Base
8
9
  before_filter :multisite_caching
9
10
  end
10
11
  include Spud::ApplicationHelper
11
- before_filter :to
12
-
12
+ before_filter :set_mailer_default_url
13
13
 
14
- private
14
+ private
15
15
 
16
- def to
17
- ActionMailer::Base.default_url_options = {:host => request.host_with_port}
18
- end
16
+ def set_mailer_default_url
17
+ ActionMailer::Base.default_url_options = {:host => request.host_with_port}
18
+ end
19
19
 
20
- def current_user_session
21
- return @current_user_session if defined?(@current_user_session)
22
- @current_user_session = SpudUserSession.find
23
- end
20
+ def current_user_session
21
+ return @current_user_session if defined?(@current_user_session)
22
+ @current_user_session = SpudUserSession.find
23
+ end
24
24
 
25
- def current_user
26
- return @current_user if defined?(@current_user)
27
- @current_user = current_user_session && current_user_session.spud_user
28
- end
25
+ def current_user
26
+ return @current_user if defined?(@current_user)
27
+ @current_user = current_user_session && current_user_session.spud_user
28
+ end
29
29
 
30
- def current_user_permissions
31
- return @current_user_permissions if defined?(@current_user_permissions)
32
- @current_user_permissions = current_user.spud_admin_permissions.where(:access => true).all
33
- end
30
+ def current_user_permissions
31
+ return @current_user_permissions if defined?(@current_user_permissions)
32
+ @current_user_permissions = current_user.spud_admin_permissions.where(:access => true).all
33
+ end
34
34
 
35
- def require_user
36
- unless current_user
37
- store_location
38
- flash[:notice] = "You must be logged in to access this page"
39
- redirect_to new_spud_user_session_url
40
- return false
41
- end
42
- return true
43
- end
44
-
45
- def require_no_user
46
- if current_user
47
- store_location
48
- flash[:notice] = "You must be logged out to access this page"
49
- redirect_to root_url
50
- return false
51
- end
35
+ def require_user
36
+ unless current_user
37
+ store_location
38
+ flash[:notice] = "You must be logged in to access this page"
39
+ redirect_to spud_admin_login_path
40
+ return false
52
41
  end
42
+ return true
43
+ end
53
44
 
54
- def store_location
55
- session[:return_to] = request.url
45
+ def require_no_user
46
+ if current_user
47
+ store_location
48
+ flash[:notice] = "You must be logged out to access this page"
49
+ redirect_to root_path
50
+ return false
56
51
  end
52
+ end
57
53
 
58
- def redirect_back_or_default(default)
59
- redirect_to(back_or_default(default))
60
- end
54
+ def store_location
55
+ session[:return_to] = request.url
56
+ end
61
57
 
62
- def back_or_default(default)
63
- result = !session[:return_to].blank? ? session[:return_to] : default
64
- session[:return_to] = nil
65
- return result
66
- end
58
+ def redirect_back_or_default(default)
59
+ redirect_to(back_or_default(default))
60
+ end
67
61
 
68
- def set_time_zone
69
- old_time_zone = Time.zone
70
- Time.zone = current_user.time_zone if current_user and current_user.time_zone.blank? == false
71
- yield
72
- ensure
73
- Time.zone = old_time_zone
74
- end
62
+ def back_or_default(default)
63
+ result = !session[:return_to].blank? ? session[:return_to] : default
64
+ session[:return_to] = nil
65
+ return result
66
+ end
75
67
 
76
- def multisite_caching
77
- if Spud::Core.multisite_mode_enabled
78
- @old_cache_directory = Rails.application.config.action_controller.page_cache_directory
79
- if(@old_cache_directory.blank?)
80
- @old_cache_directory = Rails.application.config.action_controller.page_cache_directory = File.join(Rails.root,'public')
81
- end
82
- site_config = Spud::Core.site_config_for_host request.host_with_port
68
+ def set_time_zone
69
+ old_time_zone = Time.zone
70
+ Time.zone = current_user.time_zone if current_user and current_user.time_zone.blank? == false
71
+ yield
72
+ ensure
73
+ Time.zone = old_time_zone
74
+ end
83
75
 
84
- self.class.page_cache_directory = File.join(@old_cache_directory.to_s,site_config[:short_name].to_s.downcase)
85
- logger.debug "Cache directory set to: #{Rails.application.config.action_controller.page_cache_directory}"
76
+ def multisite_caching
77
+ if Spud::Core.multisite_mode_enabled
78
+ @old_cache_directory = Rails.application.config.action_controller.page_cache_directory
79
+ if(@old_cache_directory.blank?)
80
+ @old_cache_directory = Rails.application.config.action_controller.page_cache_directory = File.join(Rails.root,'public')
86
81
  end
82
+ site_config = Spud::Core.site_config_for_host request.host_with_port
83
+
84
+ self.class.page_cache_directory = File.join(@old_cache_directory.to_s,site_config[:short_name].to_s.downcase)
85
+ logger.debug "Cache directory set to: #{Rails.application.config.action_controller.page_cache_directory}"
87
86
  end
87
+ end
88
88
 
89
89
  end
@@ -5,14 +5,14 @@ class Spud::SetupController < Spud::ApplicationController
5
5
  @page_name = "First Time Setup"
6
6
  if SpudUser.count != 0
7
7
  flash[:error] = "Access Denied! This wizard may only be executed when the database is empty."
8
- redirect_to new_spud_user_session_url and return
8
+ redirect_to spud_admin_login_path and return
9
9
  end
10
10
 
11
11
  if request.post?
12
12
  @user = SpudUser.new(:login => params[:login],:email => params[:email],:password => params[:password],:password_confirmation => params[:password_confirmation])
13
13
  @user.super_admin = true
14
14
  if @user.save
15
- redirect_back_or_default(new_spud_user_session_url) and return
15
+ redirect_back_or_default(spud_admin_login_path) and return
16
16
  end
17
17
 
18
18
  flash[:error] = "Error creating administrative account!"
@@ -3,7 +3,7 @@ class Spud::CoreMailer < ActionMailer::Base
3
3
 
4
4
  def forgot_password_notification(user)
5
5
  @user = user
6
- @url = edit_spud_password_reset_url(:id => user.perishable_token)
6
+ @url = spud_admin_password_reset_url(user.perishable_token)
7
7
  # @url = "/spud/password_resets/#{user.perishable_token}/edit"
8
8
  mail(:from =>Spud::Core.from_address,:to => user.email, :subject => "Forgot Password Request from #{Spud::Core.config.site_name}")
9
9
 
@@ -12,9 +12,10 @@
12
12
  <%=link_to spud_admin_root_url do%>
13
13
  <h1><%= Spud::Core.config.site_name %> Admin</h1>
14
14
  <%end%>
15
-
16
15
  <div id="user_meta">
17
- <span class="greeting">Hello <%=@current_user.full_name%></span>&nbsp;|&nbsp;<%=link_to "Settings", spud_settings_path%>&nbsp;|&nbsp;<%=link_to "Logout",spud_user_session_url,:method => :delete%></a>
16
+ <span class="greeting">Hello <%= @current_user.full_name %></span> |
17
+ <%=link_to "Settings", spud_admin_settings_path%> |
18
+ <%=link_to "Logout",spud_admin_logout_path %>
18
19
  </div>
19
20
  <%if Spud::Core.multisite_mode_enabled == true%>
20
21
  <div id="multisite_switcher" class="right_floated">
@@ -1,6 +1,6 @@
1
1
  <div class="login-form">
2
2
  <h1>Forgot Password</h1>
3
- <%= form_tag spud_password_resets_path do %>
3
+ <%= form_tag spud_admin_password_resets_path do %>
4
4
 
5
5
  <div class="field-group">
6
6
  <%= label_tag :email %>
@@ -1,6 +1,6 @@
1
1
  <div class="login-form">
2
- <h1>Spud CMS Admin</h1>
3
- <%= form_for @user, url: spud_password_reset_path(:id => @user.perishable_token) do |f| %>
2
+ <h1>Password Reset</h1>
3
+ <%= form_for @user, url: spud_admin_password_reset_path(:id => @user.perishable_token) do |f| %>
4
4
  <% if flash[:notice] %>
5
5
  <div class="alert alert-success">
6
6
  <%= flash[:notice] %>
@@ -22,4 +22,4 @@
22
22
  </div>
23
23
 
24
24
  <% end %>
25
- </div>
25
+ </div>
@@ -1,4 +1,4 @@
1
- <%=error_messages_for f.object%>
1
+ <%= error_messages_for f.object %>
2
2
  <fieldset>
3
3
  <legend>User Details</legend>
4
4
 
@@ -0,0 +1,8 @@
1
+ <p>Fields marked with * are required and must be filled out.</p>
2
+
3
+ <%= form_for @current_user, :url => spud_admin_settings_path, :method => :put, :html => {:class => "form-horizontal"} do |f| %>
4
+ <%= render :partial => "form", :locals => {:f => f} %>
5
+ <div class="form-actions">
6
+ <%= f.submit "Save Settings", :class=>"btn btn-primary"%> or <%=link_to "cancel",request.referer,:class => "btn" %>
7
+ </div>
8
+ <% end %>
@@ -1,6 +1,6 @@
1
1
  <div class="login-form">
2
- <h1>Spud CMS Admin</h1>
3
- <%= form_for @user_session, url: spud_user_session_path do |f| %>
2
+ <h1>Login</h1>
3
+ <%= form_for @user_session, :url => spud_admin_login_path do |f| %>
4
4
  <% if flash[:notice] %>
5
5
  <div class="alert alert-success">
6
6
  <%= flash[:notice] %>
@@ -20,7 +20,7 @@
20
20
  <%= f.check_box :remember_me %> <%= f.label :remember_me, class: 'inline' %>
21
21
  </div>
22
22
  <div class="field-group">
23
- <%= f.submit "Login" %> or <%=link_to "Forgot Password?",new_spud_password_reset_url%>
23
+ <%= f.submit "Login" %> or <%=link_to "Forgot Password?", spud_admin_password_resets_path %>
24
24
  </div>
25
25
 
26
26
  <% end %>
data/config/routes.rb CHANGED
@@ -1,18 +1,27 @@
1
1
  Rails.application.routes.draw do
2
- namespace :spud do
3
- resource :user_session
4
- resource :user
5
- match 'settings' => "users#settings"
6
- match 'save_key' => "users#save_setting"
7
- namespace :admin do
8
- root :to => "dashboard#index"
9
- resources :users
10
- match 'switch' => "dashboard#switch"
11
- end
12
- resource :sitemap,:only => [:show]
13
- resources :password_resets
14
- match 'setup' => 'setup#index'
15
- end
2
+
3
+ namespace :spud, :path => '/' do
4
+ namespace :admin do
5
+
6
+ get 'login' => 'user_sessions#new', :as => 'login'
7
+ post 'login' => 'user_sessions#create'
8
+ match 'logout' => 'user_sessions#destroy', :as => 'logout'
9
+
10
+ resources :password_resets, :only => [:index, :create, :show, :update], :path => 'forgot'
11
+
12
+ get 'settings' => 'settings#edit', :as => 'settings'
13
+ put 'settings' => 'settings#update'
14
+
15
+ root :to => "dashboard#index"
16
+ resources :users
17
+ match 'switch' => "dashboard#switch"
18
+ end
19
+
20
+ resource :sitemap, :only => [:show]
21
+
22
+ match 'setup' => 'setup#index'
23
+ end
16
24
 
17
- end
25
+ get 'spud/admin' => 'spud/admin/user_sessions#legacy_redirect'
18
26
 
27
+ end
@@ -2,7 +2,12 @@ module Spud
2
2
  module Core
3
3
  include ActiveSupport::Configurable
4
4
  config_accessor :site_name,:admin_applications,:sitemap_urls,:multisite_mode_enabled,:multisite_config,:from_address,:site_id,:short_name, :javascripts,:stylesheets, :admin_javascripts, :admin_stylesheets
5
- self.admin_applications = [{:name => "Users",:thumbnail => "spud/admin/users_thumb.png",:url => "/spud/admin/users",:order => 100}]
5
+ self.admin_applications = [{
6
+ :name => "Users",
7
+ :thumbnail => "spud/admin/users_thumb.png",
8
+ :url => '/admin/users',
9
+ :order => 100
10
+ }]
6
11
  self.site_name = "Company Name"
7
12
  self.site_id = 0
8
13
  self.short_name = 'default'
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = "1.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -33,7 +33,7 @@ describe Spud::Admin::ApplicationController do
33
33
  @session.destroy
34
34
  get :index
35
35
 
36
- response.should redirect_to(new_spud_user_session_url)
36
+ response.should redirect_to(spud_admin_login_path)
37
37
  end
38
38
 
39
39
  it "should redirect to the root for a user without administrative priviledges" do
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Spud::PasswordResetsController do
3
+ describe Spud::Admin::PasswordResetsController do
4
4
  let(:user) { FactoryGirl.build(:spud_user, :id => 1) }
5
5
 
6
6
  context :get do
7
- describe :new do
7
+ describe :index do
8
8
  it "should return success" do
9
- get :new
9
+ get :index
10
10
  response.should be_success
11
11
  end
12
12
  end
13
13
 
14
- describe :edit do
14
+ describe :show do
15
15
  context "with a valid id" do
16
16
  before(:all) do
17
17
  SpudUser.stubs(:find_using_perishable_token).returns(user)
18
18
  end
19
19
 
20
20
  it "should render the edit form" do
21
- get :edit, :id => 1
21
+ get :show, :id => 1
22
22
  response.should be_success
23
23
  end
24
24
  end
@@ -29,8 +29,8 @@ describe Spud::PasswordResetsController do
29
29
  end
30
30
 
31
31
  it "should redirect to the login form" do
32
- get :edit, :id => user.id
33
- response.should redirect_to(new_spud_user_session_url)
32
+ get :show, :id => user.id
33
+ response.should redirect_to(spud_admin_login_path)
34
34
  end
35
35
  end
36
36
  end
@@ -52,7 +52,7 @@ describe Spud::PasswordResetsController do
52
52
 
53
53
  it "should redirect to the login form" do
54
54
  post :create, :email => user.email
55
- response.should redirect_to(new_spud_user_session_url)
55
+ response.should redirect_to(spud_admin_login_path)
56
56
  end
57
57
  end
58
58
 
@@ -62,7 +62,7 @@ describe Spud::PasswordResetsController do
62
62
  end
63
63
  it "should re-render the password reset form" do
64
64
  post :create, :email => "invalid@email.com"
65
- response.should render_template("new")
65
+ response.should render_template("index")
66
66
  end
67
67
  end
68
68
  end
@@ -78,14 +78,14 @@ describe Spud::PasswordResetsController do
78
78
  context "with valid password entry" do
79
79
  it "should save and redirect to the login form" do
80
80
  post :update, valid_data
81
- response.should redirect_to(new_spud_user_session_url)
81
+ response.should redirect_to(spud_admin_login_path)
82
82
  end
83
83
  end
84
84
 
85
85
  context "with an invalid password entry" do
86
86
  it "should re-render the password form" do
87
87
  post :update, invalid_data
88
- response.should render_template("edit")
88
+ response.should render_template("show")
89
89
  end
90
90
  end
91
91
  end
@@ -1,27 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Spud::UsersController do
3
+ describe Spud::Admin::SettingsController do
4
4
  before(:each) do
5
5
  activate_authlogic
6
6
  SpudUserSession.create(FactoryGirl.build(:spud_user))
7
7
  end
8
8
 
9
- describe :settings do
9
+ describe :edit do
10
10
  it "should respond with success" do
11
- get :settings
12
-
11
+ get :edit
13
12
  response.should be_success
14
13
  end
15
14
 
16
15
  it "should have a page thumbnail" do
17
- get :settings
18
-
16
+ get :edit
19
17
  assigns(:page_thumbnail).should_not be_blank
20
18
  end
21
19
 
22
20
  it "should have a page name" do
23
- get :settings
24
-
21
+ get :edit
25
22
  assigns(:page_name).should_not be_blank
26
23
  end
27
24
  end
@@ -55,15 +52,4 @@ describe Spud::UsersController do
55
52
  end
56
53
  end
57
54
 
58
- describe :save_setting do
59
- it "should fail if no params are passed" do
60
- get :save_setting
61
- response.should_not be_success
62
- end
63
-
64
- it "should save key value pair when passed" do
65
- get :save_setting,:key => "test",:value => "testval"
66
- response.should be_success
67
- end
68
- end
69
55
  end