Sha256: d0835db9048bfcad34eb082908fb2bd70e35c9d300ed392df467d28bb0bcba5c

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

require_relative 'spec_helper'
require_relative '../lib/rapid-vaults'

describe RapidVaults do
  #  let(:rapidvaults) { RapidVaults.new('fixtures/foo.yml', 'fixtures/key.txt', 'fixtures/nonce.txt', 'fixtures/tag.txt') }

  context '.process' do
    it 'raises an error for a non-string password' do
      RapidVaults.instance_variable_set(:@settings, action: :encrypt, file: 'a', key: 'b', nonce: 'c', pw: 1)
      expect { RapidVaults.process }.to raise_error('Password must be a string.')
    end
    it 'raises an error for a missing argument to encrypt' do
      RapidVaults.instance_variable_set(:@settings, action: :encrypt, file: 'a', key: 'b')
      expect { RapidVaults.process }.to raise_error('File, key, and nonce arguments are required for encryption.')
    end
    it 'raises an error for a missing argument to decrypt' do
      RapidVaults.instance_variable_set(:@settings, action: :decrypt, file: 'a', key: 'b', nonce: 'c')
      expect { RapidVaults.process }.to raise_error('File, key, nonce, and tag arguments are required for decryption.')
    end
    it 'raises an error for a missing action' do
      RapidVaults.instance_variable_set(:@settings, file: 'a', key: 'b', nonce: 'c', tag: 'd')
      expect { RapidVaults.process }.to raise_error('Action must be one of generate, encrypt, or decrypt.')
    end
    it 'raises an error for a nonexistent input file' do
      RapidVaults.instance_variable_set(:@settings, action: :encrypt, file: 'a', key: 'b', nonce: 'c', tag: 'd')
      expect { RapidVaults.process }.to raise_error('Input file is not an existing file.')
    end
    it 'reads in all input files correctly for decryption' do
      #
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapid-vaults-1.0.0 spec/rapid-vaults_spec.rb