From 80fbc144aca978261cbd5cd647ff285412827d46 Mon Sep 17 00:00:00 2001 From: Stella Date: Sun, 18 Jan 2015 22:01:05 +0200 Subject: [PATCH] remove user deletion until further notice --- app/controllers/admin/users_controller.rb | 5 ----- app/views/admin/users/index.html.haml | 9 --------- spec/controllers/admin/users_controller_spec.rb | 15 --------------- spec/features/user_spec.rb | 14 +------------- 4 files changed, 1 insertion(+), 42 deletions(-) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 57f898ce..bfe0b4cf 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -35,10 +35,5 @@ module Admin end def edit; end - - def destroy - @user.destroy - redirect_to admin_users_path, notice: 'User got deleted' - end end end diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 17d25df2..8790a596 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -18,7 +18,6 @@ %th Roles %th View %th Edit - %th Delete %tbody - @users.each do |user| %tr @@ -48,11 +47,3 @@ - if can? :update, user %td = link_to 'Edit', edit_admin_user_path(user), class: 'btn btn-primary' - - if can? :destroy, user - %td - - if current_user.id == user.id or user.role_ids.include? 3 - = link_to 'Delete',admin_user_path(user), :method => :delete , :data => {:confirm => 'Are you sure ?'}, - disabled: true, class: 'btn btn-primary disabled btn-danger', role: 'button' - - else - = link_to 'Delete',admin_user_path(user), method: :delete, - data: { confirm: 'Are you sure ?' }, class: 'btn btn-primary btn-danger' \ No newline at end of file diff --git a/spec/controllers/admin/users_controller_spec.rb b/spec/controllers/admin/users_controller_spec.rb index 87759372..1a9b9569 100644 --- a/spec/controllers/admin/users_controller_spec.rb +++ b/spec/controllers/admin/users_controller_spec.rb @@ -36,19 +36,4 @@ describe Admin::UsersController do end end end - describe 'DELETE #destroy' do - before :each do - @user = create(:user) - end - context 'valid attributes' do - it 'it deletes the contact' do - expect { delete :destroy, id: @user.id }.to change(User, :count).by(-1) - end - it 'redirects to users#index' do - delete :destroy, id: @user - expect(response).to redirect_to admin_users_path - end - end - end - end diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 6a7b12f6..7294ec5c 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -3,19 +3,7 @@ require 'spec_helper' feature User do shared_examples 'admin ability' do - scenario 'deletes a user', feature: true, js: true do - sign_in(create(:admin)) - visit admin_users_path - expected_count = User.count - 1 - page.all('btn btn-primary btn-danger') do - click_link 'Delete' - page.evaluate_script('window.confirm = function() { return true; }') - page.click('OK') - expect(flash).to eq('User got deleted') - expect(User.count).to eq(expected_count) - end - sign_out - end + end describe 'admin' do