add_checklists_spec.rb 800 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe AddChecklists, db_strategy: :reset, type: :db_migration do
  4. before do
  5. remove_reference :tickets, :checklist
  6. %i[checklist_template_items checklist_templates checklist_items checklists].each do |table|
  7. drop_table table
  8. end
  9. Setting.find_by(name: 'checklist')&.destroy
  10. Permission.find_by(name: 'admin.checklist')&.destroy
  11. migrate
  12. end
  13. it 'adds setting' do
  14. expect(Setting).to exist(name: 'checklist')
  15. end
  16. it 'adds permission' do
  17. expect(Permission).to exist(name: 'admin.checklist')
  18. end
  19. it 'creates tables' do
  20. expect(tables).to include('checklist_templates', 'checklist_template_items', 'checklists', 'checklist_items')
  21. end
  22. end