diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 122d986..8bc8984 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -40,11 +40,6 @@ class AccountsController < ApplicationController end end - def destroy - @account.destroy - redirect_to accounts_url, notice: 'Account was successfully destroyed.' - end - private def set_account diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index 6d3a65f..f1396b8 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -25,6 +25,5 @@ <%= @account.contact_email %>

-<%= link_to 'Destroy', @account, method: :delete, data: { confirm: 'Are you sure?' } %> <%= link_to 'Edit', edit_account_path(@account) %> | <%= link_to 'Back', accounts_path %> diff --git a/config/routes.rb b/config/routes.rb index cb15a7f..fad8164 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true Rails.application.routes.draw do get 'accounts/reveal/:id', to: 'accounts#reveal', as: :reveal_password - resources :accounts + resources :accounts, except: [:destroy] get "logout", to: "auth#logout", as: :logout get "login", to: "auth#login", as: :login diff --git a/test/controllers/accounts_controller/edit_test.rb b/test/controllers/accounts_controller/edit_test.rb index ba9d86a..7587481 100644 --- a/test/controllers/accounts_controller/edit_test.rb +++ b/test/controllers/accounts_controller/edit_test.rb @@ -50,12 +50,4 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_match(/failed to update/i, flash[:error]) end - - test "should destroy account" do - assert_difference('Account.count', -1) do - delete account_url(@account) - end - - assert_redirected_to accounts_url - end end