mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Add users management to site settings (#126)
This commit is contained in:
committed by
GitHub
parent
bc15140512
commit
37fb99a868
@@ -22,4 +22,20 @@ FactoryBot.define do
|
||||
password { 'password' }
|
||||
role { 'admin' }
|
||||
end
|
||||
|
||||
factory :blocked, class: User do
|
||||
sequence(:email) { |n| "admin#{n}@example.com" }
|
||||
|
||||
full_name { 'First Last' }
|
||||
password { 'password' }
|
||||
status { 'blocked' }
|
||||
end
|
||||
|
||||
factory :deleted, class: User do
|
||||
sequence(:email) { |n| "admin#{n}@example.com" }
|
||||
|
||||
full_name { 'First Last' }
|
||||
password { 'password' }
|
||||
status { 'deleted' }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ RSpec.describe User, type: :model do
|
||||
expect(user).to be_valid
|
||||
end
|
||||
|
||||
it 'creates a user with role "user" by default' do
|
||||
it 'has role "user" by default' do
|
||||
expect(User.new.role).to eq('user')
|
||||
end
|
||||
|
||||
@@ -23,6 +23,24 @@ RSpec.describe User, type: :model do
|
||||
expect(admin).to be_valid
|
||||
end
|
||||
|
||||
it 'has status "active" by default' do
|
||||
expect(User.new.status).to eq('active')
|
||||
end
|
||||
|
||||
it 'can have the following statuses: "active", "blocked" and "deleted"' do
|
||||
active = user
|
||||
blocked = FactoryBot.build(:blocked)
|
||||
deleted = FactoryBot.build(:deleted)
|
||||
|
||||
expect(user.status).to eq('active')
|
||||
expect(blocked.status).to eq('blocked')
|
||||
expect(deleted.status).to eq('deleted')
|
||||
|
||||
expect(user).to be_valid
|
||||
expect(blocked).to be_valid
|
||||
expect(deleted).to be_valid
|
||||
end
|
||||
|
||||
it 'has a non-nil and non-empty full name' do
|
||||
nil_name_user = FactoryBot.build(:user, full_name: nil)
|
||||
empty_name_user = FactoryBot.build(:user, full_name: '')
|
||||
@@ -54,4 +72,11 @@ RSpec.describe User, type: :model do
|
||||
expect(moderator).to be_a_power_user
|
||||
expect(admin).to be_a_power_user
|
||||
end
|
||||
|
||||
it 'knows if it is active or blocked' do
|
||||
expect(user).to be_active
|
||||
|
||||
blocked = FactoryBot.build(:blocked)
|
||||
expect(blocked).to be_blocked
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'requests to boards in the admin panel', :admin_panel, type: :request do
|
||||
let(:user) { FactoryBot.create(:user) }
|
||||
let(:moderator) { FactoryBot.create(:moderator) }
|
||||
let(:admin) { FactoryBot.create(:admin) }
|
||||
|
||||
let(:board) { FactoryBot.create(:board) }
|
||||
|
||||
context 'when user is not logged in' do
|
||||
it 'redirects index action' do
|
||||
get admin_boards_path
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_board_path(board)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_board_path
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_board_path(board)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_boards_path, params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_board_path(board), params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_board_path(board)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "user"' do
|
||||
before(:each) do
|
||||
user.confirm
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'redirects index action' do
|
||||
get admin_boards_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_board_path(board)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_board_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_board_path(board)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_boards_path, params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_board_path(board), params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_board_path(board)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "moderator"' do
|
||||
before(:each) do
|
||||
moderator.confirm
|
||||
sign_in moderator
|
||||
end
|
||||
|
||||
it 'fulfills index action' do
|
||||
get admin_boards_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills show action' do
|
||||
get admin_board_path(board)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills new action' do
|
||||
get new_admin_board_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills edit action' do
|
||||
get edit_admin_board_path(board)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills create action' do
|
||||
post admin_boards_path, params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(admin_board_path(board.id + 1))
|
||||
end
|
||||
it 'fulfills update action' do
|
||||
patch admin_board_path(board), params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(admin_board_path(board))
|
||||
end
|
||||
it 'fulfills destroy action' do
|
||||
delete admin_board_path(board)
|
||||
expect(response).to redirect_to(admin_root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "admin"' do
|
||||
before(:each) do
|
||||
admin.confirm
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
it 'fulfills index action' do
|
||||
get admin_boards_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills show action' do
|
||||
get admin_board_path(board)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills new action' do
|
||||
get new_admin_board_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills edit action' do
|
||||
get edit_admin_board_path(board)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills create action' do
|
||||
post admin_boards_path, params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(admin_board_path(board.id + 1))
|
||||
end
|
||||
it 'fulfills update action' do
|
||||
patch admin_board_path(board), params: { board: { name: board.name + 'a' } }
|
||||
expect(response).to redirect_to(admin_board_path(board))
|
||||
end
|
||||
it 'fulfills destroy action' do
|
||||
delete admin_board_path(board)
|
||||
expect(response).to redirect_to(admin_root_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,148 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'requests to post statuses in the admin panel', :admin_panel, type: :request do
|
||||
let(:user) { FactoryBot.create(:user) }
|
||||
let(:moderator) { FactoryBot.create(:moderator) }
|
||||
let(:admin) { FactoryBot.create(:admin) }
|
||||
|
||||
let(:post_status) { FactoryBot.create(:post_status) }
|
||||
|
||||
context 'when user is not logged in' do
|
||||
it 'redirects index action' do
|
||||
get admin_post_statuses_path
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_post_status_path
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_post_statuses_path, params: { post_status: { name: post_status.name + 'a' } }
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_post_status_path(post_status), params: { post_status: { name: post_status.name + 'a' } }
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "user"' do
|
||||
before(:each) do
|
||||
user.confirm
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'redirects index action' do
|
||||
get admin_post_statuses_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_post_status_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_post_statuses_path, params: { post_status: { name: post_status.name + 'a' } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_post_status_path(post_status), params: { post_status: { name: post_status.name + 'a' } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "moderator"' do
|
||||
before(:each) do
|
||||
moderator.confirm
|
||||
sign_in moderator
|
||||
end
|
||||
|
||||
it 'fulfills index action' do
|
||||
get admin_post_statuses_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills show action' do
|
||||
get admin_post_status_path(post_status)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills new action' do
|
||||
get new_admin_post_status_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills edit action' do
|
||||
get edit_admin_post_status_path(post_status)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills create action' do
|
||||
post admin_post_statuses_path, params: { post_status: { name: post_status.name + 'a', color: post_status.color } }
|
||||
expect(response).to redirect_to(admin_post_status_path(post_status.id + 1))
|
||||
end
|
||||
it 'fulfills update action' do
|
||||
patch admin_post_status_path(post_status), params: { post_status: { name: post_status.name + 'a' } }
|
||||
expect(response).to redirect_to(admin_post_status_path(post_status))
|
||||
end
|
||||
it 'fulfills destroy action' do
|
||||
delete admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(admin_post_statuses_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "admin"' do
|
||||
before(:each) do
|
||||
admin.confirm
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
it 'fulfills index action' do
|
||||
get admin_post_statuses_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills show action' do
|
||||
get admin_post_status_path(post_status)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills new action' do
|
||||
get new_admin_post_status_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills edit action' do
|
||||
get edit_admin_post_status_path(post_status)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills create action' do
|
||||
post admin_post_statuses_path, params: { post_status: { name: post_status.name + 'a', color: post_status.color } }
|
||||
expect(response).to redirect_to(admin_post_status_path(post_status.id + 1))
|
||||
end
|
||||
it 'fulfills update action' do
|
||||
patch admin_post_status_path(post_status), params: { post_status: { name: post_status.name + 'a' } }
|
||||
expect(response).to redirect_to(admin_post_status_path(post_status))
|
||||
end
|
||||
it 'fulfills destroy action' do
|
||||
delete admin_post_status_path(post_status)
|
||||
expect(response).to redirect_to(admin_post_statuses_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,146 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'requests to users in the admin panel', :admin_panel, type: :request do
|
||||
let(:user) { FactoryBot.create(:user) }
|
||||
let(:moderator) { FactoryBot.create(:moderator) }
|
||||
let(:admin) { FactoryBot.create(:admin) }
|
||||
|
||||
context 'when user is not logged in' do
|
||||
it 'redirects index action' do
|
||||
get admin_users_path
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_user_path(user)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_user_path
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_user_path(user)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_users_path, params: { user: { full_name: user.full_name, email: user.email + 'a', password: user.password } }
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_user_path(user), params: { user: { full_name: user.full_name } }
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_user_path(user)
|
||||
expect(response).to redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "user"' do
|
||||
before(:each) do
|
||||
user.confirm
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'redirects index action' do
|
||||
get admin_users_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_user_path(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_user_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_user_path(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_users_path, params: { user: { full_name: user.full_name, email: user.email + 'a', password: user.password } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_user_path(user), params: { user: { full_name: user.full_name } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_user_path(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "moderator"' do
|
||||
before(:each) do
|
||||
moderator.confirm
|
||||
sign_in moderator
|
||||
end
|
||||
|
||||
it 'redirects index action' do
|
||||
get admin_users_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects show action' do
|
||||
get admin_user_path(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects new action' do
|
||||
get new_admin_user_path
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects edit action' do
|
||||
get edit_admin_user_path(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects create action' do
|
||||
post admin_users_path, params: { user: { full_name: user.full_name, email: user.email + 'a', password: user.password } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects update action' do
|
||||
patch admin_user_path(user), params: { user: { full_name: user.full_name } }
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
it 'redirects destroy action' do
|
||||
delete admin_user_path(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user has role "admin"' do
|
||||
before(:each) do
|
||||
admin.confirm
|
||||
sign_in admin
|
||||
end
|
||||
|
||||
it 'fulfills index action' do
|
||||
get admin_users_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills show action' do
|
||||
get admin_user_path(user)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills new action' do
|
||||
get new_admin_user_path
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills edit action' do
|
||||
get edit_admin_user_path(user)
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
it 'fulfills create action' do
|
||||
post admin_users_path, params: { user: { full_name: user.full_name, email: user.email + 'a', password: user.password } }
|
||||
expect(response).to redirect_to(admin_user_path(user.id + 1))
|
||||
end
|
||||
it 'fulfills update action' do
|
||||
patch admin_user_path(user), params: { user: { full_name: user.full_name + 'a', password: '' } }
|
||||
expect(response).to redirect_to(admin_user_path(user))
|
||||
end
|
||||
it 'fulfills destroy action' do
|
||||
delete admin_user_path(user)
|
||||
expect(response).to redirect_to(admin_users_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,128 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin panel routing', :aggregate_failures, type: :routing do
|
||||
it 'routes root to boards index action' do
|
||||
expect(get: '/admin').to route_to(
|
||||
controller: 'admin/boards', action: 'index')
|
||||
end
|
||||
|
||||
it 'routes boards' do
|
||||
expect(get: '/admin/boards').to route_to(
|
||||
controller: 'admin/boards', action: 'index'
|
||||
)
|
||||
expect(get: '/admin/boards/1').to route_to(
|
||||
controller: 'admin/boards', action: 'show', id: '1'
|
||||
)
|
||||
expect(get: '/admin/boards/new').to route_to(
|
||||
controller: 'admin/boards', action: 'new'
|
||||
)
|
||||
expect(get: '/admin/boards/1/edit').to route_to(
|
||||
controller: 'admin/boards', action: 'edit', id: '1'
|
||||
)
|
||||
expect(post: '/admin/boards').to route_to(
|
||||
controller: 'admin/boards', action: 'create'
|
||||
)
|
||||
expect(patch: '/admin/boards/1').to route_to(
|
||||
controller: 'admin/boards', action: 'update', id: '1'
|
||||
)
|
||||
expect(delete: '/admin/boards/1').to route_to(
|
||||
controller: 'admin/boards', action: 'destroy', id: '1'
|
||||
)
|
||||
end
|
||||
|
||||
it 'routes comments' do
|
||||
expect(get: '/admin/comments').to route_to(
|
||||
controller: 'admin/comments', action: 'index'
|
||||
)
|
||||
expect(get: '/admin/comments/1').to route_to(
|
||||
controller: 'admin/comments', action: 'show', id: '1'
|
||||
)
|
||||
expect(get: '/admin/comments/new').to route_to(
|
||||
controller: 'admin/comments', action: 'new'
|
||||
)
|
||||
expect(get: '/admin/comments/1/edit').to route_to(
|
||||
controller: 'admin/comments', action: 'edit', id: '1'
|
||||
)
|
||||
expect(post: '/admin/comments').to route_to(
|
||||
controller: 'admin/comments', action: 'create'
|
||||
)
|
||||
expect(patch: '/admin/comments/1').to route_to(
|
||||
controller: 'admin/comments', action: 'update', id: '1'
|
||||
)
|
||||
expect(delete: '/admin/comments/1').to route_to(
|
||||
controller: 'admin/comments', action: 'destroy', id: '1'
|
||||
)
|
||||
end
|
||||
|
||||
it 'routes posts' do
|
||||
expect(get: '/admin/posts').to route_to(
|
||||
controller: 'admin/posts', action: 'index'
|
||||
)
|
||||
expect(get: '/admin/posts/1').to route_to(
|
||||
controller: 'admin/posts', action: 'show', id: '1'
|
||||
)
|
||||
expect(get: '/admin/posts/new').to route_to(
|
||||
controller: 'admin/posts', action: 'new'
|
||||
)
|
||||
expect(get: '/admin/posts/1/edit').to route_to(
|
||||
controller: 'admin/posts', action: 'edit', id: '1'
|
||||
)
|
||||
expect(post: '/admin/posts').to route_to(
|
||||
controller: 'admin/posts', action: 'create'
|
||||
)
|
||||
expect(patch: '/admin/posts/1').to route_to(
|
||||
controller: 'admin/posts', action: 'update', id: '1'
|
||||
)
|
||||
expect(delete: '/admin/posts/1').to route_to(
|
||||
controller: 'admin/posts', action: 'destroy', id: '1'
|
||||
)
|
||||
end
|
||||
|
||||
it 'routes post statuses' do
|
||||
expect(get: '/admin/post_statuses').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'index'
|
||||
)
|
||||
expect(get: '/admin/post_statuses/1').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'show', id: '1'
|
||||
)
|
||||
expect(get: '/admin/post_statuses/new').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'new'
|
||||
)
|
||||
expect(get: '/admin/post_statuses/1/edit').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'edit', id: '1'
|
||||
)
|
||||
expect(post: '/admin/post_statuses').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'create'
|
||||
)
|
||||
expect(patch: '/admin/post_statuses/1').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'update', id: '1'
|
||||
)
|
||||
expect(delete: '/admin/post_statuses/1').to route_to(
|
||||
controller: 'admin/post_statuses', action: 'destroy', id: '1'
|
||||
)
|
||||
end
|
||||
|
||||
it 'routes users' do
|
||||
expect(get: '/admin/users').to route_to(
|
||||
controller: 'admin/users', action: 'index'
|
||||
)
|
||||
expect(get: '/admin/users/1').to route_to(
|
||||
controller: 'admin/users', action: 'show', id: '1'
|
||||
)
|
||||
expect(get: '/admin/users/new').to route_to(
|
||||
controller: 'admin/users', action: 'new'
|
||||
)
|
||||
expect(get: '/admin/users/1/edit').to route_to(
|
||||
controller: 'admin/users', action: 'edit', id: '1'
|
||||
)
|
||||
expect(post: '/admin/users').to route_to(
|
||||
controller: 'admin/users', action: 'create'
|
||||
)
|
||||
expect(patch: '/admin/users/1').to route_to(
|
||||
controller: 'admin/users', action: 'update', id: '1'
|
||||
)
|
||||
expect(delete: '/admin/users/1').to route_to(
|
||||
controller: 'admin/users', action: 'destroy', id: '1'
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user