diff --git a/config/routes.rb b/config/routes.rb
index c8c0de6..a948b20 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,72 +1,77 @@
Rails.application.routes.draw do
root 'application#index'
post 'login' => 'application#login'
match 'vima', to: 'application#vima', :via => [:get, :post]
get 'logout' => 'application#logout'
resources :clients, only: [:index, :show] do
member do
get :jobs
get :logs
get :stats
post :stats
get :users
end
collection do
post :index
end
end
resources :hosts, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
post :submit_config
get :restore
post :run_restore
post :disable
delete :revoke
end
resources :jobs, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
patch :toggle_enable
post :backup_now
end
end
resources :filesets, only: [:show, :new, :create, :destroy]
resources :schedules, only: [:show, :new, :edit, :create, :update, :destroy]
end
namespace :admin do
match '/', to: 'base#index', via: [:get, :post]
resources :settings, only: [:index, :new, :create, :edit, :update] do
member do
delete :reset
end
end
resources :clients, only: [:index, :show] do
member do
get :jobs
get :logs
get :stats
post :stats
get :configuration
end
end
resources :hosts, only: [:show] do
collection do
get :unverified
end
member do
post :verify
end
end
- resources :users, only: [:index]
+ resources :users, only: [:index] do
+ member do
+ patch :ban
+ patch :unban
+ end
+ end
end
end
diff --git a/spec/routing/admin/users_routing_spec.rb b/spec/routing/admin/users_routing_spec.rb
new file mode 100644
index 0000000..ee6f272
--- /dev/null
+++ b/spec/routing/admin/users_routing_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe Admin::UsersController do
+ it 'routes GET /admin/users' do
+ expect(get('/admin/users')).to route_to(controller: 'admin/users', action: 'index')
+ end
+
+ it 'routes PATCH /admin/users/1/ban' do
+ expect(patch('/admin/users/1/ban')).
+ to route_to(controller: 'admin/users', action: 'ban', id: '1')
+ end
+
+ it 'routes PATCH /admin/users/1/unban' do
+ expect(patch('/admin/users/1/unban')).
+ to route_to(controller: 'admin/users', action: 'unban', id: '1')
+ end
+end