summaryrefslogtreecommitdiff
path: root/spec/migrations/generate_lets_encrypt_private_key_spec.rb
blob: f47cc0c36efddb813a327a5d05c200dc7fa61c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'spec_helper'
require Rails.root.join('db', 'migrate', '20190524062810_generate_lets_encrypt_private_key.rb')

describe GenerateLetsEncryptPrivateKey, :migration do
  describe '#up' do
    let(:applications_settings) { table(:applications_settings) }

    it 'generates RSA private key and saves it in application settings' do
      application_setting = described_class::ApplicationSetting.create!

      described_class.new.up
      application_setting.reload

      expect(application_setting.lets_encrypt_private_key).to be_present
      expect do
        OpenSSL::PKey::RSA.new(application_setting.lets_encrypt_private_key)
      end.not_to raise_error
    end
  end
end