and_or_conditions_setting_default_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe AndOrConditionsSettingDefault, type: :db_migration do
  4. before do
  5. Setting.find_by(name: 'ticket_allow_expert_conditions').destroy!
  6. Setting.create(
  7. title: 'Ticket Conditions Expert Mode',
  8. name: 'ticket_allow_expert_conditions',
  9. area: 'Ticket::Base',
  10. description: 'Defines if the ticket conditions editor supports complex logical expressions.',
  11. options: {
  12. form: [
  13. {
  14. display: '',
  15. null: true,
  16. name: 'ticket_allow_expert_conditions',
  17. tag: 'boolean',
  18. options: {
  19. true => 'yes',
  20. false => 'no',
  21. },
  22. },
  23. ],
  24. },
  25. state: false,
  26. preferences: {
  27. prio: 4000,
  28. permission: ['admin.ticket'],
  29. },
  30. frontend: true
  31. )
  32. migrate
  33. end
  34. it 'does migrate ticket_allow_expert_conditions setting' do
  35. expect(Setting.find_by(name: 'ticket_allow_expert_conditions')).to have_attributes(
  36. area: 'Ticket::Core',
  37. state_current: {
  38. value: true,
  39. },
  40. state_initial: {
  41. value: true,
  42. },
  43. preferences: {
  44. online_service_disable: true,
  45. permission: ['admin.ticket'],
  46. }
  47. )
  48. end
  49. end