group_spec.rb 664 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Group', authenticated_as: -> { user }, type: :request do
  4. describe 'Zammad returns stack error when one tries to remove groups via API #3841' do
  5. let(:group) { create(:group) }
  6. let(:ticket) { create(:ticket, group: group) }
  7. let(:user) { create(:admin) }
  8. before do
  9. ticket
  10. end
  11. it 'does return reference error on delete if related objects exist' do
  12. delete "/api/v1/groups/#{group.id}", params: {}, as: :json
  13. expect(json_response['error']).to eq("Can't delete, object has references.")
  14. end
  15. end
  16. end