issue_4461_kb_feed_token_persistent_spec.rb 734 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue4461KbFeedTokenPersistent, current_user_id: 1, type: :db_migration do
  4. context 'when a KB feed token exists' do
  5. before do
  6. Token.ensure_token! 'KnowledgeBaseFeed'
  7. end
  8. it 'makes token persistent' do
  9. expect { migrate }
  10. .to change { Token.find_by(action: 'KnowledgeBaseFeed').persistent }
  11. .to(true)
  12. end
  13. end
  14. context 'when a different token exists' do
  15. before do
  16. Token.ensure_token! 'OtherToken'
  17. end
  18. it 'does not touch the token' do
  19. expect { migrate }
  20. .not_to change { Token.find_by(action: 'OtherToken').persistent }
  21. end
  22. end
  23. end