issue2641_kb_color_change_limit_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue2641KbColorChangeLimit, db_strategy: :reset, type: :db_migration do
  4. subject(:knowledge_base) { create(:knowledge_base) }
  5. before do
  6. Setting.create_if_not_exists(
  7. title: 'Kb active',
  8. name: 'kb_active',
  9. area: 'Kb::Core',
  10. description: 'Defines if KB navbar button is enabled. Updated in KnowledgeBase callback.',
  11. state: false,
  12. preferences: {
  13. prio: 1,
  14. trigger: ['menu:render'],
  15. authentication: true,
  16. permission: ['admin.knowledge_base'],
  17. },
  18. frontend: true
  19. )
  20. Setting.create_if_not_exists(
  21. title: 'Kb active publicly',
  22. name: 'kb_active_publicly',
  23. area: 'Kb::Core',
  24. description: 'Defines if KB navbar button is enabled for users without KB permission. Updated in CanBePublished callback.',
  25. state: false,
  26. preferences: {
  27. prio: 1,
  28. trigger: ['menu:render'],
  29. authentication: true,
  30. permission: [],
  31. },
  32. frontend: true
  33. )
  34. end
  35. it "doesn't change value for existing KB" do
  36. expect { migrate }
  37. .to not_change { knowledge_base.color_header }.and not_change { knowledge_base.color_highlight }
  38. end
  39. end