destroy_spec.rb 541 B

12345678910111213141516
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Service::Channel::Admin::Destroy, :aggregate_failures, current_user_id: 1 do
  4. subject(:service) { described_class.new(area: channel.area, channel_id: channel.id) }
  5. let!(:channel) { create(:channel) }
  6. describe '#execute' do
  7. it 'destroys the channel' do
  8. expect { service.execute }.to change(Channel, :count).by(-1)
  9. expect { channel.reload }.to raise_error(ActiveRecord::RecordNotFound)
  10. end
  11. end
  12. end