spec/system/system_spec.rb in rapid-vaults-1.1.2 vs spec/system/system_spec.rb in rapid-vaults-1.2.0
- old
+ new
@@ -5,17 +5,17 @@
describe RapidVaults do
after(:all) do
require 'fileutils'
%w[key.txt nonce.txt tag.txt encrypted.txt decrypted.txt chef.rb puppet_gpg_decrypt.rb puppet_gpg_encrypt.rb puppet_ssl_decrypt.rb puppet_ssl_encrypt.rb].each { |file| File.delete(file) }
- unless File.directory?('/home/travis')
- %w[random_seed pubring.kbx trustdb.gpg pubring.kbx~ S.gpg-agent].each { |file| File.delete(file) }
+ unless ENV['TRAVIS'] == 'true' || ENV['CIRCLECI'] == 'true' || ENV['GITHUB_ACTIONS'] == 'true'
+ %w[random_seed pubring.kbx trustdb.gpg pubring.kbx~].each { |file| File.delete(file) }
%w[openpgp-revocs.d private-keys-v1.d].each { |dir| FileUtils.rm_r(dir) }
end
end
- context 'executed as a system from the CLI with settings and a file to be processed' do
+ context 'executed with openssl algorithm as a system from the CLI with settings and a file to be processed' do
it 'generates key and nonce, encrypts a file, and then decrypts a file in order' do
# generate and utilize files inside suitable directory
Dir.chdir(fixtures_dir)
# generate key and nonce
@@ -33,11 +33,11 @@
expect(File.file?('decrypted.txt')).to be true
expect(File.read('decrypted.txt')).to eq("foo: bar\n")
end
end
- context 'executed as a system from the API with settings and a file to be processed' do
+ context 'executed with openssl algorithm as a system from the API with settings and a file to be processed' do
it 'generates key and nonce, encrypts a file, and then decrypts a file in order' do
# generate and utilize files inside suitable directory
Dir.chdir(fixtures_dir)
# generate key and nonce
@@ -57,13 +57,13 @@
expect(decrypt).to be_a(String)
expect(decrypt).to eq("foo: bar\n")
end
end
- # travis ci cannot support non-interactive gpg encryption
- unless File.directory?('/home/travis')
- context 'executed wtih gpg as a system from the CLI with settings and a file to be processed' do
+ # all three ci cannot support end-to-end gpg generate/encrypt/decrypt
+ unless ENV['TRAVIS'] == 'true' || ENV['CIRCLECI'] == 'true' || ENV['GITHUB_ACTIONS'] == 'true'
+ context 'executed wtih gpg algorithm as a system from the CLI with settings and a file to be processed' do
it 'encrypts a file and then decrypts a file in order' do
ENV['GNUPGHOME'] = fixtures_dir
# generate and utilize files inside suitable directory
Dir.chdir(fixtures_dir)
@@ -84,18 +84,18 @@
expect(File.file?('decrypted.txt')).to be true
expect(File.read('decrypted.txt')).to eq("foo: bar\n")
end
end
- context 'executed with gpg as a system from the API with settings and a file to be processed' do
+ context 'executed with gpg algorithm as a system from the API with settings and a file to be processed' do
it 'encrypts a file and then decrypts a file in order' do
ENV['GNUPGHOME'] = fixtures_dir
# generate and utilize files inside suitable directory
Dir.chdir(fixtures_dir)
# generate keys
- RapidVaults::API.main(action: :generate, algorithm: :gpgme, gpgparams: File.read('gpgparams.txt'), ui: :cli)
+ RapidVaults::API.main(action: :generate, algorithm: :gpgme, gpgparams: File.read('gpgparams.txt'))
%w[trustdb.gpg pubring.kbx pubring.kbx~].each { |file| expect(File.file?("#{fixtures_dir}/#{file}")).to be true }
%w[openpgp-revocs.d private-keys-v1.d].each { |dir| expect(File.directory?("#{fixtures_dir}/#{dir}")).to be true }
# generate encrypted file
encrypt = RapidVaults::API.main(algorithm: :gpgme, action: :encrypt, file: 'file.yaml', pw: 'password')