sets_last_owner_update_time_examples.rb 604 B

123456789101112131415161718192021222324
  1. require 'rails_helper'
  2. RSpec.shared_examples 'TicketSetsLastOwnerUpdateTime' do
  3. subject { create(described_class.name.underscore) }
  4. let(:new_owner) { create(:agent, groups: [subject.group]) }
  5. it 'can only be loaded for tickets' do
  6. expect(described_class).to eq Ticket
  7. end
  8. before do
  9. travel_to Time.zone.now
  10. end
  11. it 'has no last_owner_update_at initially' do
  12. expect(subject.last_owner_update_at).to be_nil
  13. end
  14. it 'gets last_owner_update_at after user change' do
  15. subject.update(owner: new_owner)
  16. expect(subject.last_owner_update_at).to eq(Time.zone.now)
  17. end
  18. end