+
diff --git a/app/views/admin/users/new.html.erb b/app/views/admin/users/new.html.erb
new file mode 100644
index 0000000..010faa0
--- /dev/null
+++ b/app/views/admin/users/new.html.erb
@@ -0,0 +1,11 @@
+
+
+
+
+
New Admin
+
+ <%= render partial: 'form' %>
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 5f840c9..eedbac6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,81 +1,81 @@
Rails.application.routes.draw do
root 'application#index'
post 'grnet' => 'application#grnet'
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
get :restore
post :run_restore
end
collection do
post :index
end
end
resources :hosts, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
post :submit_config
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]
get '/login' => 'base#login', as: :login
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
post :disable
delete :revoke
end
end
resources :hosts, only: [:show] do
collection do
get :unverified
end
member do
post :verify
end
end
- resources :users, only: [:index] do
+ resources :users, only: [:index, :new, :create] 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
index ee6f272..ea0505b 100644
--- a/spec/routing/admin/users_routing_spec.rb
+++ b/spec/routing/admin/users_routing_spec.rb
@@ -1,17 +1,27 @@
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 GET /admin/users/new' do
+ expect(get('/admin/users/new')).
+ to route_to(controller: 'admin/users', action: 'new')
+ end
+
+ it 'routes POST /admin/users' do
+ expect(post('/admin/users')).
+ to route_to(controller: 'admin/users', action: 'create')
+ 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