add_checklists_spec.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. %i[checklist_template_items checklist_templates checklist_items checklists].each do |table|
  6. ActiveRecord::Migration[5.0].drop_table table
  7. end
  8. Setting.find_by(name: 'checklist')&.destroy
  9. Permission.find_by(name: 'admin.checklist')&.destroy
  10. migrate
  11. end
  12. it 'adds setting' do
  13. expect(Setting.find_by(name: 'checklist')).to be_present
  14. end
  15. it 'adds permission' do
  16. expect(Permission.find_by(name: 'admin.checklist')).to be_present
  17. end
  18. it 'creates checklist_templates table' do
  19. expect(table_exists?(:checklist_templates)).to be(true)
  20. end
  21. it 'creates checklist_template_items table' do
  22. expect(table_exists?(:checklist_template_items)).to be(true)
  23. end
  24. it 'creates checklists table' do
  25. expect(table_exists?(:checklists)).to be(true)
  26. end
  27. it 'creates checklist_items table' do
  28. expect(table_exists?(:checklist_items)).to be(true)
  29. end
  30. end