diff options
Diffstat (limited to 'spec/controllers/admin/topics_controller_spec.rb')
-rw-r--r-- | spec/controllers/admin/topics_controller_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/controllers/admin/topics_controller_spec.rb b/spec/controllers/admin/topics_controller_spec.rb index 67943525687..ee36d5f1def 100644 --- a/spec/controllers/admin/topics_controller_spec.rb +++ b/spec/controllers/admin/topics_controller_spec.rb @@ -151,4 +151,26 @@ RSpec.describe Admin::TopicsController do end end end + + describe 'DELETE #destroy' do + it 'removes topic' do + delete :destroy, params: { id: topic.id } + + expect(response).to redirect_to(admin_topics_path) + expect { topic.reload }.to raise_error(ActiveRecord::RecordNotFound) + end + + context 'as a normal user' do + before do + sign_in(user) + end + + it 'renders a 404 error' do + delete :destroy, params: { id: topic.id } + + expect(response).to have_gitlab_http_status(:not_found) + expect { topic.reload }.not_to raise_error + end + end + end end |