item_spec.rb 907 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Checklist::Item, :aggregate_failures, type: :model do
  4. describe 'history entries for checked' do
  5. let(:checklist) do
  6. create(:checklist, item_count: 1)
  7. end
  8. it 'creates history entries for checked' do
  9. checklist.items.first.update!(checked: true)
  10. history_type_id = History::Type.find_by(name: 'checklist_item_checked').id
  11. expect(History.last).to have_attributes(
  12. history_type_id: history_type_id,
  13. value_from: checklist.items.first.text,
  14. value_to: 'true',
  15. )
  16. checklist.items.first.update!(checked: false)
  17. expect(History.last).to have_attributes(
  18. history_type_id: history_type_id,
  19. value_from: checklist.items.first.text,
  20. value_to: 'false',
  21. )
  22. end
  23. end
  24. end