system_assets_spec.rb 803 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'System Assets', type: :request do
  4. describe '#show' do
  5. it 'returns content for product logo' do
  6. allow(Service::SystemAssets::ProductLogo).to receive(:sendable_asset).and_return(
  7. Service::SystemAssets::SendableAsset.new(
  8. content: 'product_logo',
  9. filename: 'test',
  10. type: 'image/test'
  11. )
  12. )
  13. get '/api/v1/system_assets/product_logo/123'
  14. expect(response)
  15. .to have_http_status(:ok)
  16. .and(have_attributes(body: 'product_logo'))
  17. end
  18. it 'returns 404 for unknown item' do
  19. get '/api/v1/system_assets/example/123'
  20. expect(response).to have_http_status(:not_found)
  21. end
  22. end
  23. end