issue_5147_modified_operator_spec.rb 1.2 KB

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue5147ModifiedOperator, type: :db_migration do
  4. let(:core_workflow_1) { create(:core_workflow, condition_selected: { 'ticket.tree_select_749211'=>{ 'operator'=>'has changed' } }) }
  5. let(:core_workflow_2) { create(:core_workflow, condition_saved: { 'ticket.tree_select_749211'=>{ 'operator' => 'changed to', 'value' => [], 'value_completion' => '' } }) }
  6. let(:core_workflow_3) { create(:core_workflow, condition_selected: { 'ticket.tree_select_749211'=>{ 'operator' => 'is', 'value' => [], 'value_completion' => '' } }) }
  7. before do
  8. core_workflow_1
  9. core_workflow_2
  10. migrate
  11. end
  12. it 'does change the operator from has changed to just changed' do
  13. expect(core_workflow_1.reload.condition_selected['ticket.tree_select_749211']['operator']).to eq('just changed')
  14. end
  15. it 'does change the operator from has changed to to just changed to' do
  16. expect(core_workflow_2.reload.condition_saved['ticket.tree_select_749211']['operator']).to eq('just changed to')
  17. end
  18. it 'does not change the operator' do
  19. expect(core_workflow_3.reload.condition_selected['ticket.tree_select_749211']['operator']).to eq('is')
  20. end
  21. end