administration-zero 0.0.13 → 0.0.14
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/administration_zero/version.rb +1 -1
- data/lib/generators/admin/install/templates/controllers/admin/base_controller.rb +2 -2
- data/lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb +7 -7
- data/lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb +4 -4
- data/lib/generators/admin/install/templates/controllers/admin/users_controller.rb +12 -12
- data/lib/generators/admin/install/templates/erb/admin/password_resets/edit.html.erb +2 -2
- data/lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.html.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.text.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/users/_form.html.erb +4 -4
- data/lib/generators/admin/install/templates/erb/admin/users/edit.html.erb +2 -2
- data/lib/generators/admin/install/templates/erb/admin/users/index.html.erb +7 -7
- data/lib/generators/admin/install/templates/erb/admin/users/new.html.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/users/show.html.erb +6 -6
- data/lib/generators/admin/install/templates/mailers/admin/user_mailer.rb +3 -3
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/home_controller_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/password_resets_controller_test.rb +5 -5
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb +5 -5
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/users_controller_test.rb +6 -6
- data/lib/generators/admin/install/templates/test_unit/system/admin/password_resets_test.rb +3 -3
- data/lib/generators/admin/install/templates/test_unit/system/admin/sessions_test.rb +4 -4
- data/lib/generators/admin/install/templates/test_unit/system/admin/users_test.rb +5 -5
- data/lib/generators/admin/scaffold/templates/system_test.rb.tt +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a291ddd1aa06b883bcbd143aeef64c9d2d87045b12fa4f33fc048987fe67ac79
|
4
|
+
data.tar.gz: ac6de3699a5db5e9f02052c70b4bbf7ea80558801a7e930df4c44fb17356124b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dc53a371733b5a796bded1aed343f94e9db143f65393a2e2f1aca27339c57df2aca9bca84458a35534ce21be2a46cc68a51f51b0386429fe8d4d7cd7d2155ec
|
7
|
+
data.tar.gz: d9a3abf79a2c4b3c5e95fa040b2ed4af7cbeb1d47ecdf99416820e3872ff7ef2c746e24dc062c81cdaf7e9e38b7fd6ac6f5eb98ed34a8bba9aadda21a00389f4
|
data/Gemfile.lock
CHANGED
@@ -9,8 +9,8 @@ class Admin::BaseController < ActionController::Base
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def authenticate
|
12
|
-
if
|
13
|
-
Admin::Current.user =
|
12
|
+
if user = Admin::User.find_by_id(session[:admin_user_id])
|
13
|
+
Admin::Current.user = user
|
14
14
|
else
|
15
15
|
redirect_to admin_sign_in_path
|
16
16
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Admin::PasswordResetsController < Admin::BaseController
|
2
2
|
skip_before_action :authenticate
|
3
3
|
|
4
|
-
before_action :
|
4
|
+
before_action :set_user, only: %i[ edit update ]
|
5
5
|
|
6
6
|
layout "admin/authentication"
|
7
7
|
|
@@ -12,8 +12,8 @@ class Admin::PasswordResetsController < Admin::BaseController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def create
|
15
|
-
if @
|
16
|
-
Admin::UserMailer.with(
|
15
|
+
if @user = Admin::User.find_by(email: params[:email])
|
16
|
+
Admin::UserMailer.with(user: @user).password_reset.deliver_later
|
17
17
|
redirect_to admin_sign_in_path, notice: "Check your email for reset instructions"
|
18
18
|
else
|
19
19
|
redirect_to new_admin_password_reset_path, alert: "Sorry, we didn't recognize that email address"
|
@@ -21,7 +21,7 @@ class Admin::PasswordResetsController < Admin::BaseController
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def update
|
24
|
-
if @
|
24
|
+
if @user.update(user_params)
|
25
25
|
redirect_to admin_sign_in_path, notice: "Your password was reset successfully. Please sign in"
|
26
26
|
else
|
27
27
|
render :edit, status: :unprocessable_entity
|
@@ -29,13 +29,13 @@ class Admin::PasswordResetsController < Admin::BaseController
|
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
|
-
def
|
33
|
-
@
|
32
|
+
def set_user
|
33
|
+
@user = Admin::User.find_signed!(params[:token], purpose: :password_reset)
|
34
34
|
rescue
|
35
35
|
redirect_to new_admin_password_reset_path, alert: "That password reset link is invalid"
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def user_params
|
39
39
|
params.permit(:password, :password_confirmation)
|
40
40
|
end
|
41
41
|
end
|
@@ -4,14 +4,14 @@ class Admin::SessionsController < Admin::BaseController
|
|
4
4
|
layout "admin/authentication"
|
5
5
|
|
6
6
|
def new
|
7
|
-
@
|
7
|
+
@user = Admin::User.new
|
8
8
|
end
|
9
9
|
|
10
10
|
def create
|
11
|
-
@
|
11
|
+
@user = Admin::User.find_by(email: params[:email])
|
12
12
|
|
13
|
-
if @
|
14
|
-
session[:admin_user_id] = @
|
13
|
+
if @user && @user.authenticate(params[:password])
|
14
|
+
session[:admin_user_id] = @user.id; redirect_to(admin_path)
|
15
15
|
else
|
16
16
|
redirect_to admin_sign_in_path(email_hint: params[:email]), alert: "That email or password is incorrect"
|
17
17
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class Admin::UsersController < Admin::BaseController
|
2
|
-
before_action :
|
2
|
+
before_action :set_user, only: %i[ show edit update destroy ]
|
3
3
|
|
4
4
|
def index
|
5
5
|
@search = Admin::User.all.ransack(params[:q])
|
6
6
|
|
7
7
|
respond_to do |format|
|
8
|
-
format.html { @pagy, @
|
8
|
+
format.html { @pagy, @users = pagy(@search.result) }
|
9
9
|
format.csv { render csv: @search.result }
|
10
10
|
end
|
11
11
|
end
|
@@ -14,41 +14,41 @@ class Admin::UsersController < Admin::BaseController
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def new
|
17
|
-
@
|
17
|
+
@user = Admin::User.new
|
18
18
|
end
|
19
19
|
|
20
20
|
def edit
|
21
21
|
end
|
22
22
|
|
23
23
|
def create
|
24
|
-
@
|
24
|
+
@user = Admin::User.new(user_params)
|
25
25
|
|
26
|
-
if @
|
27
|
-
redirect_to @
|
26
|
+
if @user.save
|
27
|
+
redirect_to @user, notice: "User was successfully created."
|
28
28
|
else
|
29
29
|
render :new, status: :unprocessable_entity
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def update
|
34
|
-
if @
|
35
|
-
redirect_to @
|
34
|
+
if @user.update(user_params)
|
35
|
+
redirect_to @user, notice: "User was successfully updated."
|
36
36
|
else
|
37
37
|
render :edit, status: :unprocessable_entity
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def destroy
|
42
|
-
@
|
42
|
+
@user.destroy
|
43
43
|
redirect_to admin_users_url, notice: "User was successfully destroyed."
|
44
44
|
end
|
45
45
|
|
46
46
|
private
|
47
|
-
def
|
48
|
-
@
|
47
|
+
def set_user
|
48
|
+
@user = Admin::User.find(params[:id])
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def user_params
|
52
52
|
params.require(:admin_user).permit(:email, :password, :password_confirmation)
|
53
53
|
end
|
54
54
|
end
|
@@ -7,13 +7,13 @@
|
|
7
7
|
<div class="mb-3">
|
8
8
|
<%= form.label :password, "New password", class: "form-label" %>
|
9
9
|
<%= form.password_field :password, required: true, autofocus: true, autocomplete: "new-password", class: "form-control" %>
|
10
|
-
<%= tag.div @
|
10
|
+
<%= tag.div @user.errors[:password].first, class: "invalid-feedback d-block" %>
|
11
11
|
</div>
|
12
12
|
|
13
13
|
<div>
|
14
14
|
<%= form.label :password_confirmation, "Confirm new password", class: "form-label" %>
|
15
15
|
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", class: "form-control" %>
|
16
|
-
<%= tag.div @
|
16
|
+
<%= tag.div @user.errors[:password_confirmation].first, class: "invalid-feedback d-block" %>
|
17
17
|
</div>
|
18
18
|
|
19
19
|
<div class="form-footer">
|
@@ -5,7 +5,7 @@
|
|
5
5
|
</head>
|
6
6
|
<body>
|
7
7
|
<p>Hey there,</p>
|
8
|
-
<p>Can't remember your password for <strong><%= @
|
8
|
+
<p>Can't remember your password for <strong><%= @user.email %></strong>? That's OK, it happens. Just hit the link below to set a new one.</p>
|
9
9
|
<p><%= link_to "Reset my password", edit_admin_password_reset_url(token: @signed_id) %></p>
|
10
10
|
<p>If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.</p>
|
11
11
|
<hr>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Hey there,
|
2
2
|
|
3
|
-
Can't remember your password for <%= @
|
3
|
+
Can't remember your password for <%= @user.email %>? That's OK, it happens. Just hit the link below to set a new one.
|
4
4
|
|
5
5
|
[Reset my password]<%= edit_admin_password_reset_url(token: @signed_id) %>
|
6
6
|
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<%= form_with(model:
|
1
|
+
<%= form_with(model: user) do |form| %>
|
2
2
|
<div class="form-group row mb-2">
|
3
3
|
<%= form.label :email, class: "form-label col-md-3 col-form-label" %>
|
4
4
|
<div class="col-md px-0">
|
5
5
|
<%= form.email_field :email, autocomplete: "email", class: "form-control" %>
|
6
|
-
<%= tag.div
|
6
|
+
<%= tag.div user.errors[:email].first, class: "invalid-feedback" %>
|
7
7
|
</div>
|
8
8
|
</div>
|
9
9
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<%= form.label :password, class: "form-label col-md-3 col-form-label" %>
|
12
12
|
<div class="col-md px-0">
|
13
13
|
<%= form.password_field :password, required: true, autocomplete: "new-password", class: "form-control" %>
|
14
|
-
<%= tag.div
|
14
|
+
<%= tag.div user.errors[:password].first, class: "invalid-feedback" %>
|
15
15
|
</div>
|
16
16
|
</div>
|
17
17
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<%= form.label :password_confirmation, class: "form-label col-md-3 col-form-label" %>
|
20
20
|
<div class="col-md px-0">
|
21
21
|
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", class: "form-control" %>
|
22
|
-
<%= tag.div
|
22
|
+
<%= tag.div user.errors[:password_confirmation].first, class: "invalid-feedback" %>
|
23
23
|
</div>
|
24
24
|
</div>
|
25
25
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<%= render "page_header_breadcrumb", title: "Editing user" do %>
|
3
3
|
<li class="breadcrumb-item"><%= link_to "Admin", admin_path %></li>
|
4
4
|
<li class="breadcrumb-item"><%= link_to "Users", admin_users_path %></li>
|
5
|
-
<li class="breadcrumb-item"><%= link_to @
|
5
|
+
<li class="breadcrumb-item"><%= link_to @user.email, @user %></li>
|
6
6
|
<% end %>
|
7
7
|
<% end %>
|
8
8
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<div class="container-xl">
|
11
11
|
<div class="card">
|
12
12
|
<div class="card-body">
|
13
|
-
<%= render "form",
|
13
|
+
<%= render "form", user: @user %>
|
14
14
|
</div>
|
15
15
|
</div>
|
16
16
|
</div>
|
@@ -23,15 +23,15 @@
|
|
23
23
|
</tr>
|
24
24
|
</thead>
|
25
25
|
<tbody>
|
26
|
-
<% @
|
26
|
+
<% @users.each do |user| %>
|
27
27
|
<tr>
|
28
|
-
<td><%= link_to
|
29
|
-
<td><%=
|
30
|
-
<td><%= l(
|
28
|
+
<td><%= link_to user.id, user %></td>
|
29
|
+
<td><%= user.email %></td>
|
30
|
+
<td><%= l(user.created_at, format: :long) %></td>
|
31
31
|
<td>
|
32
|
-
<%= link_to "View",
|
33
|
-
<%= link_to "Edit", edit_admin_user_path(
|
34
|
-
<%= button_to "Delete",
|
32
|
+
<%= link_to "View", user, class: "btn btn-light btn-sm" %>
|
33
|
+
<%= link_to "Edit", edit_admin_user_path(user), class: "btn btn-light btn-sm" %>
|
34
|
+
<%= button_to "Delete", user, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-light btn-sm" %>
|
35
35
|
</td>
|
36
36
|
</tr>
|
37
37
|
<% end %>
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<%= render "page_header" do %>
|
2
|
-
<%= render "page_header_breadcrumb", title: @
|
2
|
+
<%= render "page_header_breadcrumb", title: @user.email do %>
|
3
3
|
<li class="breadcrumb-item"><%= link_to "Admin", admin_path %></li>
|
4
4
|
<li class="breadcrumb-item"><%= link_to "Users", admin_users_path %></li>
|
5
5
|
<% end %>
|
6
6
|
|
7
7
|
<%= render "page_header_actions" do %>
|
8
|
-
<%= link_to "Edit user", edit_admin_user_path(@
|
9
|
-
<%= button_to "Delete user", @
|
8
|
+
<%= link_to "Edit user", edit_admin_user_path(@user), class: "btn btn-primary" %>
|
9
|
+
<%= button_to "Delete user", @user, method: :delete, "data-confirm": "Are you sure?", form_class: "d-inline", class: "btn btn-light" %>
|
10
10
|
<% end %>
|
11
11
|
<% end %>
|
12
12
|
|
@@ -19,13 +19,13 @@
|
|
19
19
|
<div class="card-body">
|
20
20
|
<dl class="row">
|
21
21
|
<dt class="col-md-3">Email</dt>
|
22
|
-
<dd class="col-md-9"><%= @
|
22
|
+
<dd class="col-md-9"><%= @user.email %></dd>
|
23
23
|
|
24
24
|
<dt class="col-md-3">Created at</dt>
|
25
|
-
<dd class="col-md-9"><%= l(@
|
25
|
+
<dd class="col-md-9"><%= l(@user.created_at, format: :long) %></dd>
|
26
26
|
|
27
27
|
<dt class="col-md-3">Updated at</dt>
|
28
|
-
<dd class="col-md-9"><%= l(@
|
28
|
+
<dd class="col-md-9"><%= l(@user.updated_at, format: :long) %></dd>
|
29
29
|
</dl>
|
30
30
|
</div>
|
31
31
|
</div>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class Admin::UserMailer < Admin::ApplicationMailer
|
2
2
|
def password_reset
|
3
|
-
@
|
4
|
-
@signed_id = @
|
3
|
+
@user = params[:user]
|
4
|
+
@signed_id = @user.signed_id(purpose: :password_reset, expires_in: 20.minutes)
|
5
5
|
|
6
|
-
mail to: @
|
6
|
+
mail to: @user.email, subject: "Reset your password"
|
7
7
|
end
|
8
8
|
end
|
@@ -2,9 +2,9 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class Admin::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
|
4
4
|
setup do
|
5
|
-
@
|
6
|
-
@sid = @
|
7
|
-
@sid_exp = @
|
5
|
+
@user = admin_users(:lazaro_nixon)
|
6
|
+
@sid = @user.signed_id(purpose: :password_reset, expires_in: 20.minutes)
|
7
|
+
@sid_exp = @user.signed_id(purpose: :password_reset, expires_in: 0.minutes)
|
8
8
|
end
|
9
9
|
|
10
10
|
test "should get new" do
|
@@ -18,8 +18,8 @@ class Admin::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
|
|
18
18
|
end
|
19
19
|
|
20
20
|
test "should send a password reset email" do
|
21
|
-
assert_enqueued_email_with Admin::UserMailer, :password_reset, args: {
|
22
|
-
post admin_password_reset_url, params: { email: @
|
21
|
+
assert_enqueued_email_with Admin::UserMailer, :password_reset, args: { user: @user } do
|
22
|
+
post admin_password_reset_url, params: { email: @user.email }
|
23
23
|
end
|
24
24
|
|
25
25
|
assert_redirected_to admin_sign_in_url
|
data/lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb
CHANGED
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class Admin::SessionsControllerTest < ActionDispatch::IntegrationTest
|
4
4
|
setup do
|
5
|
-
@
|
5
|
+
@user = admin_users(:lazaro_nixon)
|
6
6
|
end
|
7
7
|
|
8
8
|
test "should get new" do
|
@@ -11,7 +11,7 @@ class Admin::SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
11
11
|
end
|
12
12
|
|
13
13
|
test "should sign in" do
|
14
|
-
post admin_sign_in_url, params: { email: @
|
14
|
+
post admin_sign_in_url, params: { email: @user.email, password: "Secret1*3*5*" }
|
15
15
|
assert_redirected_to admin_url
|
16
16
|
|
17
17
|
get admin_url
|
@@ -19,8 +19,8 @@ class Admin::SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
19
19
|
end
|
20
20
|
|
21
21
|
test "should not sign in with wrong credentials" do
|
22
|
-
post admin_sign_in_url, params: { email: @
|
23
|
-
assert_redirected_to admin_sign_in_url(email_hint: @
|
22
|
+
post admin_sign_in_url, params: { email: @user.email, password: "SecretWrong1*3" }
|
23
|
+
assert_redirected_to admin_sign_in_url(email_hint: @user.email)
|
24
24
|
assert_equal "That email or password is incorrect", flash[:alert]
|
25
25
|
|
26
26
|
get admin_url
|
@@ -28,7 +28,7 @@ class Admin::SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
28
28
|
end
|
29
29
|
|
30
30
|
test "should sign out" do
|
31
|
-
sign_in_admin_as @
|
31
|
+
sign_in_admin_as @user
|
32
32
|
|
33
33
|
delete admin_sign_out_url
|
34
34
|
assert_redirected_to admin_sign_in_url
|
data/lib/generators/admin/install/templates/test_unit/controllers/admin/users_controller_test.rb
CHANGED
@@ -2,7 +2,7 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class Admin::UsersControllerTest < ActionDispatch::IntegrationTest
|
4
4
|
setup do
|
5
|
-
@
|
5
|
+
@user = sign_in_admin_as(admin_users(:lazaro_nixon))
|
6
6
|
end
|
7
7
|
|
8
8
|
test "should get index" do
|
@@ -24,23 +24,23 @@ class Admin::UsersControllerTest < ActionDispatch::IntegrationTest
|
|
24
24
|
end
|
25
25
|
|
26
26
|
test "should show admin_user" do
|
27
|
-
get admin_user_url(@
|
27
|
+
get admin_user_url(@user)
|
28
28
|
assert_response :success
|
29
29
|
end
|
30
30
|
|
31
31
|
test "should get edit" do
|
32
|
-
get edit_admin_user_url(@
|
32
|
+
get edit_admin_user_url(@user)
|
33
33
|
assert_response :success
|
34
34
|
end
|
35
35
|
|
36
36
|
test "should update admin_user" do
|
37
|
-
patch admin_user_url(@
|
38
|
-
assert_redirected_to admin_user_url(@
|
37
|
+
patch admin_user_url(@user), params: { admin_user: { email: @user.email, password: "NewSecret1*3*5*", password_confirmation: "NewSecret1*3*5*" } }
|
38
|
+
assert_redirected_to admin_user_url(@user)
|
39
39
|
end
|
40
40
|
|
41
41
|
test "should destroy admin_user" do
|
42
42
|
assert_difference("Admin::User.count", -1) do
|
43
|
-
delete admin_user_url(@
|
43
|
+
delete admin_user_url(@user)
|
44
44
|
end
|
45
45
|
|
46
46
|
assert_redirected_to admin_users_url
|
@@ -2,15 +2,15 @@ require "application_system_test_case"
|
|
2
2
|
|
3
3
|
class Admin::PasswordResetsTest < ApplicationSystemTestCase
|
4
4
|
setup do
|
5
|
-
@
|
6
|
-
@sid = @
|
5
|
+
@user = admin_users(:lazaro_nixon)
|
6
|
+
@sid = @user.signed_id(purpose: :password_reset, expires_in: 20.minutes)
|
7
7
|
end
|
8
8
|
|
9
9
|
test "sending a password reset email" do
|
10
10
|
visit admin_sign_in_url
|
11
11
|
click_on "I forgot password"
|
12
12
|
|
13
|
-
fill_in "Email", with: @
|
13
|
+
fill_in "Email", with: @user.email
|
14
14
|
click_on "Send me new password"
|
15
15
|
|
16
16
|
assert_text "Check your email for reset instructions"
|
@@ -2,12 +2,12 @@ require "application_system_test_case"
|
|
2
2
|
|
3
3
|
class Admin::SessionsTest < ApplicationSystemTestCase
|
4
4
|
setup do
|
5
|
-
@
|
5
|
+
@user = admin_users(:lazaro_nixon)
|
6
6
|
end
|
7
7
|
|
8
8
|
test "signing in" do
|
9
9
|
visit admin_sign_in_url
|
10
|
-
fill_in "Email", with: @
|
10
|
+
fill_in "Email", with: @user.email
|
11
11
|
fill_in "Password", with: "Secret1*3*5*"
|
12
12
|
click_on "Sign in"
|
13
13
|
|
@@ -15,10 +15,10 @@ class Admin::SessionsTest < ApplicationSystemTestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
test "signing out" do
|
18
|
-
sign_in_admin_as @
|
18
|
+
sign_in_admin_as @user
|
19
19
|
click_on "Paweł Kuna"
|
20
20
|
click_on "Logout"
|
21
21
|
|
22
|
-
assert_selector "
|
22
|
+
assert_selector "h1", text: "Login to your account"
|
23
23
|
end
|
24
24
|
end
|
@@ -2,12 +2,12 @@ require "application_system_test_case"
|
|
2
2
|
|
3
3
|
class Admin::UsersTest < ApplicationSystemTestCase
|
4
4
|
setup do
|
5
|
-
@
|
5
|
+
@user = sign_in_admin_as(admin_users(:lazaro_nixon))
|
6
6
|
end
|
7
7
|
|
8
8
|
test "visiting the index" do
|
9
9
|
visit admin_users_url
|
10
|
-
assert_selector "
|
10
|
+
assert_selector "h1", text: "Users"
|
11
11
|
end
|
12
12
|
|
13
13
|
test "should create user" do
|
@@ -23,10 +23,10 @@ class Admin::UsersTest < ApplicationSystemTestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
test "should update user" do
|
26
|
-
visit admin_user_url(@
|
26
|
+
visit admin_user_url(@user)
|
27
27
|
click_on "Edit user"
|
28
28
|
|
29
|
-
fill_in "Email", with: @
|
29
|
+
fill_in "Email", with: @user.email
|
30
30
|
fill_in "Password", with: "NewSecret1*3*5*"
|
31
31
|
fill_in "Password confirmation", with: "NewSecret1*3*5*"
|
32
32
|
click_on "Update User"
|
@@ -35,7 +35,7 @@ class Admin::UsersTest < ApplicationSystemTestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
test "should destroy user" do
|
38
|
-
visit admin_user_url(@
|
38
|
+
visit admin_user_url(@user)
|
39
39
|
page.accept_confirm { click_on "Delete user" }
|
40
40
|
|
41
41
|
assert_text "User was successfully destroyed"
|
@@ -8,7 +8,7 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
|
|
8
8
|
|
9
9
|
test "visiting the index" do
|
10
10
|
visit <%= index_helper(type: :url) %>
|
11
|
-
assert_selector "
|
11
|
+
assert_selector "h1", text: "<%= human_name.pluralize %>"
|
12
12
|
end
|
13
13
|
|
14
14
|
test "should create <%= human_name.downcase %>" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administration-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|