ticket_generic_time_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Report::TicketGenericTime do
  4. =begin
  5. result = Report::TicketGenericTime.items(
  6. range_start: '2015-01-01T00:00:00Z',
  7. range_end: '2015-12-31T23:59:59Z',
  8. selector: selector, # ticket selector to get only a collection of tickets
  9. params: { field: 'created_at' },
  10. )
  11. returns
  12. {
  13. count: 123,
  14. ticket_ids: [4,5,1,5,0,51,5,56,7,4],
  15. assets: assets,
  16. }
  17. =end
  18. describe 'items' do
  19. # Regression test for issue #2246 - Records in Reporting not updated when single ActiveRecord can not be found
  20. it 'correctly handles missing tickets' do
  21. class_double('SearchIndexBackend', selectors: { ticket_ids: [-1] }).as_stubbed_const
  22. expect do
  23. described_class.items(
  24. range_start: Time.zone.parse('2015-01-01T00:00:00Z'),
  25. range_end: Time.zone.parse('2015-12-31T23:59:59Z'),
  26. selector: {}, # ticket selector to get only a collection of tickets
  27. params: { field: 'created_at' },
  28. )
  29. end.not_to raise_error
  30. end
  31. end
  32. end