clandestine 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/safe_spec.rb DELETED
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Clandestine::Safe do
4
- include Clandestine::Crypt
5
- before :each do
6
- @safe = Clandestine::Safe.new "#{ENV['HOME']}/.tmp_pswds"
7
- Clandestine::Safe.instance_eval do
8
- attr_reader :safe_location
9
- end
10
- end
11
- after :each do
12
- @safe.self_destruct
13
- end
14
- it "should create a new safe if one doesn't already exist" do
15
- File.exists?(@safe.safe_location).should eql true
16
- end
17
- it "should remove broken sym link of file doesn't exist" do
18
- FileUtils.ln_s "#{ENV['HOME']}/.doesnt_exist", @safe.safe_location, :force => true
19
- @safe = Clandestine::Safe.new "#{ENV['HOME']}/.tmp_pswds"
20
- File.exists?("#{ENV['HOME']}/.doesnt_exist").should eql false
21
- end
22
- it "should lock data" do
23
- data = "gmail:password"
24
- @safe.lock(data, "password")
25
- decrypt(IO.readlines(@safe.safe_location).to_s, "password").should eql data
26
- end
27
- it "should unlock data" do
28
- @safe.lock "gmail:password", "password"
29
- @safe.unlock("password").should eql "gmail:password"
30
- end
31
- it "should know if it's empty" do
32
- @safe.empty?.should eql true
33
- end
34
- it "should remove sym link when self destructing" do
35
- FileUtils.ln_s("#{ENV['HOME']}/.tmp_pswds_lnk", @safe.safe_location, :force => true)
36
- @safe.self_destruct
37
- File.exists?("#{ENV['HOME']}/.tmp_pswds_lnk").should eql false
38
- File.exists?(@safe.safe_location).should eql false
39
- end
40
- end