issue_3503_fix_current_user_spec.rb 908 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue3503FixCurrentUser, type: :db_migration do
  4. let!(:job) { create(:job) }
  5. let!(:sla) { create(:sla) }
  6. before do
  7. condition = { 'ticket.organization_id' => { 'operator' => 'is', 'pre_condition' => 'current_user.organization_id', 'value' => '' }, 'ticket.action' => { 'operator' => 'is', 'value' => 'create' } }
  8. job.update_column(:condition, condition)
  9. sla.update_column(:condition, condition)
  10. end
  11. it 'removes current user condition from Jobs' do
  12. expect { migrate }.to change { job.reload.condition }.to({ 'ticket.action'=>{ 'operator' => 'is', 'value' => 'create' } })
  13. end
  14. it 'removes current user condition from Slas' do
  15. expect { migrate }.to change { sla.reload.condition }.to({ 'ticket.action'=>{ 'operator' => 'is', 'value' => 'create' } })
  16. end
  17. end