sets_last_owner_update_time_examples.rb 669 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.shared_examples 'TicketSetsLastOwnerUpdateTime' do
  4. subject { create(described_class.name.underscore) }
  5. let(:new_owner) { create(:agent, groups: [subject.group]) }
  6. it 'can only be loaded for tickets' do
  7. expect(described_class).to eq Ticket
  8. end
  9. before do
  10. freeze_time
  11. end
  12. it 'has no last_owner_update_at initially' do
  13. expect(subject.last_owner_update_at).to be_nil
  14. end
  15. it 'gets last_owner_update_at after user change' do
  16. subject.update(owner: new_owner)
  17. expect(subject.last_owner_update_at).to eq(Time.zone.now)
  18. end
  19. end