diff --git a/app/controllers/api/v1/projects_controller.rb b/app/controllers/api/v1/projects_controller.rb index f4bd9f74a..c1a8b1ccf 100644 --- a/app/controllers/api/v1/projects_controller.rb +++ b/app/controllers/api/v1/projects_controller.rb @@ -66,9 +66,7 @@ def update def destroy super do |resource| split_display_name = resource.display_name.split('_') - if split_display_name[split_display_name.length - 1] != 'deleted' - resource.update(display_name: "#{resource.display_name}_deleted") - end + resource.update(display_name: "#{resource.display_name}_deleted") unless split_display_name[split_display_name.length - 1] == 'deleted' end end diff --git a/spec/controllers/api/v1/projects_controller_spec.rb b/spec/controllers/api/v1/projects_controller_spec.rb index 7467ba453..c972c3d3e 100644 --- a/spec/controllers/api/v1/projects_controller_spec.rb +++ b/spec/controllers/api/v1/projects_controller_spec.rb @@ -845,14 +845,13 @@ def tag_request let(:resource) { create(:full_project, owner: user) } let(:instances_to_disable) { [resource] } - it_behaves_like 'is deactivatable' - + it_behaves_like 'is deactivatable' it "appends 'deleted' to display_name" do stub_token(scopes: scopes, user_id: authorized_user.id) set_preconditions - delete :destroy, params: {id: resource.id} - expect(resource.reload.display_name).to end_with('deleted') - end + delete :destroy, params: { id: resource.id } + expect(resource.reload.display_name).to end_with('deleted') + end end describe '#copy' do