Fixes 500 error caused by pending delete projects in admin dashboard
This commit is contained in:
parent
ea6dfcad9f
commit
22d53f0607
3 changed files with 26 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
class Admin::DashboardController < Admin::ApplicationController
|
||||
def index
|
||||
@projects = Project.with_route.limit(10)
|
||||
@projects = Project.without_deleted.with_route.limit(10)
|
||||
@users = User.limit(10)
|
||||
@groups = Group.with_route.limit(10)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Fixes 500 error caused by pending delete projects in admin dashboard
|
||||
merge_request: 13067
|
||||
author:
|
21
spec/controllers/admin/dashboard_controller_spec.rb
Normal file
21
spec/controllers/admin/dashboard_controller_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Admin::DashboardController do
|
||||
describe '#index' do
|
||||
context 'with pending_delete projects' do
|
||||
render_views
|
||||
|
||||
it 'does not retrieve projects that are pending deletion' do
|
||||
sign_in(create(:admin))
|
||||
|
||||
project = create(:project)
|
||||
pending_delete_project = create(:project, pending_delete: true)
|
||||
|
||||
get :index
|
||||
|
||||
expect(response.body).to match(project.name)
|
||||
expect(response.body).not_to match(pending_delete_project.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue