ticket_time_accounting_check_spec.rb 1.3 KB

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe TicketTimeAccountingCheck, type: :db_migration do
  4. let(:ldap_user) { create(:user, source: 'Ldap') }
  5. before do
  6. Setting.set('time_accounting_selector', { 'condition' =>
  7. { 'ticket.number' => { 'operator' => 'contains', 'value' => 'test' },
  8. 'ticket.title' => { 'operator' => 'contains not', 'value' => 'test2' },
  9. 'ticket.owner_id' => { 'operator' => 'is', 'pre_condition' => 'not_set', 'value' => [], 'value_completion' => '' } } })
  10. migrate
  11. end
  12. it 'does migrate the selector' do
  13. expect(Setting.get('time_accounting_selector')).to eq({ 'condition' =>
  14. { 'ticket.number' => { 'operator' => 'regex match', 'value' => 'test' },
  15. 'ticket.title' => { 'operator' => 'regex mismatch', 'value' => 'test2' },
  16. 'ticket.owner_id' => { 'operator' => 'not set' } } })
  17. end
  18. end