tb_core 1.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/controllers/spud/admin/application_controller.rb +2 -2
- data/app/controllers/spud/{password_resets_controller.rb → admin/password_resets_controller.rb} +13 -11
- data/app/controllers/spud/admin/settings_controller.rb +27 -0
- data/app/controllers/spud/{user_sessions_controller.rb → admin/user_sessions_controller.rb} +13 -7
- data/app/controllers/spud/application_controller.rb +61 -61
- data/app/controllers/spud/setup_controller.rb +2 -2
- data/app/mailers/spud/core_mailer.rb +1 -1
- data/app/views/layouts/spud/admin/application.html.erb +3 -2
- data/app/views/spud/{password_resets/new.html.erb → admin/password_resets/index.html.erb} +1 -1
- data/app/views/spud/{password_resets/edit.html.erb → admin/password_resets/show.html.erb} +3 -3
- data/app/views/spud/{users → admin/settings}/_form.html.erb +1 -1
- data/app/views/spud/admin/settings/edit.html.erb +8 -0
- data/app/views/spud/{user_sessions → admin/user_sessions}/new.html.erb +3 -3
- data/config/routes.rb +24 -15
- data/lib/spud_core/configuration.rb +6 -1
- data/lib/spud_core/version.rb +1 -1
- data/spec/controllers/spud/admin/application_controller_spec.rb +1 -1
- data/spec/controllers/spud/{password_reset_controller_spec.rb → admin/password_reset_controller_spec.rb} +11 -11
- data/spec/controllers/spud/{users_controller_spec.rb → admin/settings_controller_spec.rb} +5 -19
- data/spec/controllers/spud/{user_sessions_controller_spec.rb → admin/user_sessions_controller_spec.rb} +7 -7
- data/spec/controllers/spud/setup_controller_spec.rb +2 -2
- data/spec/dummy/log/test.log +34192 -0
- metadata +16 -16
- data/app/controllers/spud/users_controller.rb +0 -45
- 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
|
-
|
4
|
+
ZTFjY2Q4M2YxNThlMzRjNTVlNDRkYzYyMGM2OTY5NDI1ZGE1ZWY1Ng==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTlhNWEzZGU5MGExMWQ5OTM5ZmJjMTExNTE0YTk3ZWMwN2NmOWQ4Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODYyOTM4NWQ4NTI1NzUzMjYyYzkxMzVjYTA5YzAxZjBjNDM3MzMyODVlZTg4
|
10
|
+
YTFhZmE0OTEyOWE0ZTI3MDEwYzYxZTE2NjZhOGIxMjg1M2JlZGY5OTQ3Mzk5
|
11
|
+
YzdjMzNkYzkzOGU4OTQyY2Y1MGI1ODU5M2JlZGM5NzMwMTk1MGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTE0ZjY4NTBhMTFhOWFlMzBmMDU2ODAwZDUxNDRlZmM5OTgxYzE4ZjAxODI2
|
14
|
+
NjM4NDFiN2RlNDc4ZWMyODIyMWQ4ODY0MzlkMTA3ZGNjZDMxZDgwNWNmY2Yw
|
15
|
+
ZDY1NjJjOTZmZjkyMjA0NGNiZDA0NzljNzQ1YmQ0N2I1ZTg1MGU=
|
data/app/controllers/spud/{password_resets_controller.rb → admin/password_resets_controller.rb}
RENAMED
@@ -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 => [:
|
4
|
+
before_filter :load_user_using_perishable_token, :only => [:show, :update]
|
4
5
|
|
5
6
|
layout 'spud/login/application'
|
6
7
|
|
7
|
-
def
|
8
|
-
|
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
|
18
|
+
redirect_to spud_admin_login_path
|
18
19
|
else
|
19
20
|
flash[:notice] = "No user was found with that email address"
|
20
|
-
render
|
21
|
+
render 'index'
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
def
|
25
|
-
|
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
|
34
|
+
redirect_to spud_admin_login_path
|
34
35
|
else
|
35
|
-
render
|
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
|
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
|
-
|
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
|
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
|
-
|
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
|
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 :
|
12
|
-
|
12
|
+
before_filter :set_mailer_default_url
|
13
13
|
|
14
|
-
|
14
|
+
private
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def set_mailer_default_url
|
17
|
+
ActionMailer::Base.default_url_options = {:host => request.host_with_port}
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
55
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
54
|
+
def store_location
|
55
|
+
session[:return_to] = request.url
|
56
|
+
end
|
61
57
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
return result
|
66
|
-
end
|
58
|
+
def redirect_back_or_default(default)
|
59
|
+
redirect_to(back_or_default(default))
|
60
|
+
end
|
67
61
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
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
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
85
|
-
|
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
|
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(
|
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
|
-
|
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
|
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
|
-
<h1>
|
3
|
-
<%= form_for @user, url:
|
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>
|
@@ -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>
|
3
|
-
<%= form_for @user_session, url
|
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?",
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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 = [{
|
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'
|
data/lib/spud_core/version.rb
CHANGED
@@ -33,7 +33,7 @@ describe Spud::Admin::ApplicationController do
|
|
33
33
|
@session.destroy
|
34
34
|
get :index
|
35
35
|
|
36
|
-
response.should redirect_to(
|
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 :
|
7
|
+
describe :index do
|
8
8
|
it "should return success" do
|
9
|
-
get :
|
9
|
+
get :index
|
10
10
|
response.should be_success
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe :
|
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 :
|
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 :
|
33
|
-
response.should redirect_to(
|
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(
|
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("
|
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(
|
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("
|
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::
|
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 :
|
9
|
+
describe :edit do
|
10
10
|
it "should respond with success" do
|
11
|
-
get :
|
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 :
|
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 :
|
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
|