spec/rapid-vaults/cli_spec.rb in rapid-vaults-1.1.1 vs spec/rapid-vaults/cli_spec.rb in rapid-vaults-1.1.2

- old
+ new

@@ -11,15 +11,24 @@ end it 'correctly parses the arguments for decrypt' do expect(RapidVaults::CLI.parse(%w[-d -k key.txt -n nonce.txt -t tag.txt -p secret file.txt])).to eq(ui: :cli, action: :decrypt, key: 'key.txt', nonce: 'nonce.txt', tag: 'tag.txt', pw: 'secret') end it 'correctly parses the arguments for openssl generate' do - expect(RapidVaults::CLI.parse(%w[-g -o /home/bob])).to eq(ui: :cli, action: :generate, outdir: '/home/bob') + expect(RapidVaults::CLI.parse(%w[-g -o .])).to eq(ui: :cli, action: :generate, outdir: '.') end it 'correctly parses the arguments for gpg generate' do expect(RapidVaults::CLI.parse(%W[--gpg -g --gpgparams #{fixtures_dir}/file.yaml])).to eq(algorithm: :gpgme, ui: :cli, action: :generate, gpgparams: "foo: bar\n") end - it 'correctly parses the arguments for puppet integrations' do - expect(RapidVaults::CLI.parse(%w[--puppet -o /dir])).to eq(ui: :cli, action: :integrate, integrate: :puppet, outdir: '/dir') + it 'correctly parses the arguments for puppet bindings' do + expect(RapidVaults::CLI.parse(%w[-b puppet -o .])).to eq(ui: :cli, action: :binding, binding: :puppet, outdir: '.') + end + it 'raises an error for a nonexistent password file' do + expect { RapidVaults::CLI.parse(%w[-f /nopasswordhere]) }.to raise_error('Password file /nopasswordhere is not an existing file!') + end + it 'raises an error for a nonexistent gpg parameters file' do + expect { RapidVaults::CLI.parse(%w[--gpgparams /foo/bar]) }.to raise_error('GPG Parameters file /foo/bar is not an existing file!') + end + it 'raises an error for a nonexistent output directory' do + expect { RapidVaults::CLI.parse(%w[-o /foo/bar/baz]) }.to raise_error('The output directory /foo/bar/baz does not exist or is not a directory!') end end end