smime_meta_information_table_spec.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe SMIMEMetaInformationTable, db_strategy: :reset, type: :db_migration do
  4. describe 'migrate SQL table' do
  5. before do
  6. ActiveRecord::Migration[6.1].drop_table :smime_certificates
  7. ActiveRecord::Migration[6.1].create_table :smime_certificates do |t|
  8. t.string :subject, limit: 500, null: false
  9. t.string :doc_hash, limit: 250, null: false
  10. t.string :fingerprint, limit: 250, null: false
  11. t.string :modulus, limit: 1024, null: false
  12. t.datetime :not_before_at, null: true, limit: 3
  13. t.datetime :not_after_at, null: true, limit: 3
  14. t.binary :raw, limit: 10.megabytes, null: false
  15. t.binary :private_key, limit: 10.megabytes, null: true
  16. t.string :private_key_secret, limit: 500, null: true
  17. t.timestamps limit: 3, null: false
  18. end
  19. ActiveRecord::Migration[6.1].add_index :smime_certificates, [:fingerprint], unique: true
  20. ActiveRecord::Migration[6.1].add_index :smime_certificates, [:modulus]
  21. ActiveRecord::Migration[6.1].add_index :smime_certificates, [:subject]
  22. end
  23. it 'does change the table structur' do
  24. migrate
  25. expect(SMIMECertificate.column_names).to include('email_addresses')
  26. end
  27. end
  28. end