heirloom 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +6 -0
  5. data/README.md +12 -6
  6. data/heirloom.gemspec +3 -5
  7. data/lib/heirloom/catalog/verify.rb +2 -2
  8. data/lib/heirloom/cli/authorize.rb +1 -2
  9. data/lib/heirloom/cli/catalog.rb +62 -19
  10. data/lib/heirloom/cli/cleanup.rb +1 -2
  11. data/lib/heirloom/cli/destroy.rb +1 -2
  12. data/lib/heirloom/cli/download.rb +2 -3
  13. data/lib/heirloom/cli/formatter/catalog.rb +25 -11
  14. data/lib/heirloom/cli/list.rb +1 -3
  15. data/lib/heirloom/cli/rotate.rb +1 -2
  16. data/lib/heirloom/cli/setup.rb +1 -2
  17. data/lib/heirloom/cli/shared.rb +3 -0
  18. data/lib/heirloom/cli/show.rb +1 -3
  19. data/lib/heirloom/cli/tag.rb +1 -2
  20. data/lib/heirloom/cli/teardown.rb +1 -2
  21. data/lib/heirloom/cli/upload.rb +1 -2
  22. data/lib/heirloom/version.rb +1 -1
  23. data/spec/acl/s3_spec.rb +11 -11
  24. data/spec/archive/authorizer_spec.rb +20 -20
  25. data/spec/archive/builder_spec.rb +13 -13
  26. data/spec/archive/checker_spec.rb +24 -24
  27. data/spec/archive/destroyer_spec.rb +20 -20
  28. data/spec/archive/downloader_spec.rb +30 -30
  29. data/spec/archive/lister_spec.rb +7 -7
  30. data/spec/archive/reader_spec.rb +65 -65
  31. data/spec/archive/setup_spec.rb +27 -27
  32. data/spec/archive/teardowner_spec.rb +19 -19
  33. data/spec/archive/updater_spec.rb +10 -10
  34. data/spec/archive/uploader_spec.rb +26 -26
  35. data/spec/archive/verifier_spec.rb +25 -25
  36. data/spec/archive/writer_spec.rb +11 -11
  37. data/spec/archive_spec.rb +91 -93
  38. data/spec/aws/s3_spec.rb +102 -102
  39. data/spec/aws/simpledb_spec.rb +33 -63
  40. data/spec/catalog/add_spec.rb +12 -12
  41. data/spec/catalog/delete_spec.rb +14 -14
  42. data/spec/catalog/list_spec.rb +8 -8
  43. data/spec/catalog/setup_spec.rb +11 -11
  44. data/spec/catalog/show_spec.rb +13 -13
  45. data/spec/catalog/verify_spec.rb +16 -16
  46. data/spec/catalog_spec.rb +36 -36
  47. data/spec/cipher/data_spec.rb +19 -19
  48. data/spec/cipher/file_spec.rb +11 -11
  49. data/spec/cli/authorize_spec.rb +16 -16
  50. data/spec/cli/catalog_spec.rb +18 -34
  51. data/spec/cli/destroy_spec.rb +13 -13
  52. data/spec/cli/download_spec.rb +31 -31
  53. data/spec/cli/formatter/catalog_spec.rb +19 -17
  54. data/spec/cli/list_spec.rb +14 -14
  55. data/spec/cli/rotate_spec.rb +9 -9
  56. data/spec/cli/setup_spec.rb +29 -29
  57. data/spec/cli/shared_spec.rb +119 -119
  58. data/spec/cli/show_spec.rb +20 -20
  59. data/spec/cli/tag_spec.rb +18 -18
  60. data/spec/cli/teardown_spec.rb +28 -28
  61. data/spec/cli/upload_spec.rb +38 -38
  62. data/spec/config_spec.rb +21 -21
  63. data/spec/destroyer/s3_spec.rb +6 -6
  64. data/spec/directory/directory_spec.rb +19 -19
  65. data/spec/downloader/s3_spec.rb +18 -18
  66. data/spec/logger_spec.rb +9 -9
  67. data/spec/spec_helper.rb +4 -80
  68. data/spec/uploader/s3_spec.rb +35 -35
  69. metadata +23 -56
  70. data/spec/integration/authorize_spec.rb +0 -79
  71. data/spec/integration/cleanup_spec.rb +0 -77
  72. data/watchr.rb +0 -101
@@ -5,24 +5,24 @@ describe Heirloom::Catalog::Add do
5
5
  before do
6
6
  @regions = ['us-west-1', 'us-west-2']
7
7
  @bucket_prefix = 'bucket_prefix'
8
- @logger_stub = stub 'logger', :info => true
9
- @config_stub = stub 'config', :logger => @logger_stub
10
- @verify_stub = stub 'verify'
8
+ @logger_double = double 'logger', :info => true
9
+ @config_double = double 'config', :logger => @logger_double
10
+ @verify_double = double 'verify'
11
11
 
12
- @add = Heirloom::Catalog::Add.new :config => @config_stub,
12
+ @add = Heirloom::Catalog::Add.new :config => @config_double,
13
13
  :name => 'new_archive'
14
14
  Heirloom::Catalog::Verify.should_receive(:new).
15
- with(:config => @config_stub).
16
- and_return @verify_stub
15
+ with(:config => @config_double).
16
+ and_return @verify_double
17
17
  end
18
18
 
19
19
  it "should call sdb to add the entry to the catalog" do
20
- @sdb_mock = mock 'sdb'
21
- @verify_stub.stub :entry_exists_in_catalog? => false
20
+ @sdb_double = double 'sdb'
21
+ @verify_double.stub :entry_exists_in_catalog? => false
22
22
  Heirloom::AWS::SimpleDB.should_receive(:new).
23
- with(:config => @config_stub).
24
- and_return @sdb_mock
25
- @sdb_mock.should_receive(:put_attributes).
23
+ with(:config => @config_double).
24
+ and_return @sdb_double
25
+ @sdb_double.should_receive(:put_attributes).
26
26
  with 'heirloom',
27
27
  'heirloom_new_archive',
28
28
  "regions" => @regions, "bucket_prefix" => @bucket_prefix
@@ -31,7 +31,7 @@ describe Heirloom::Catalog::Add do
31
31
  end
32
32
 
33
33
  it "should not add the entry to the catalog if it's already there" do
34
- @verify_stub.stub :entry_exists_in_catalog? => true
34
+ @verify_double.stub :entry_exists_in_catalog? => true
35
35
  Heirloom::AWS::SimpleDB.should_receive(:new).never
36
36
  @add.add_to_catalog :regions => @regions,
37
37
  :bucket_prefix => @bucket_prefix
@@ -3,30 +3,30 @@ require 'spec_helper'
3
3
  describe Heirloom::Catalog::Delete do
4
4
 
5
5
  before do
6
- @logger_stub = stub 'logger', :info => true
7
- @config_stub = stub 'config', :logger => @logger_stub
8
- @verify_stub = stub 'verify'
6
+ @logger_double = double 'logger', :info => true
7
+ @config_double = double 'config', :logger => @logger_double
8
+ @verify_double = double 'verify'
9
9
  Heirloom::Catalog::Verify.should_receive(:new).
10
- with(:config => @config_stub).
11
- and_return @verify_stub
12
- @delete = Heirloom::Catalog::Delete.new :config => @config_stub,
10
+ with(:config => @config_double).
11
+ and_return @verify_double
12
+ @delete = Heirloom::Catalog::Delete.new :config => @config_double,
13
13
  :name => 'old_archive'
14
14
  end
15
15
 
16
16
  it "should delete the entry from the catalog" do
17
- @verify_stub.stub :catalog_domain_exists? => true
18
- @sdb_mock = mock 'sdb'
17
+ @verify_double.stub :catalog_domain_exists? => true
18
+ @sdb_double = double 'sdb'
19
19
  Heirloom::AWS::SimpleDB.should_receive(:new).
20
- with(:config => @config_stub).
21
- and_return @sdb_mock
22
- @sdb_mock.should_receive(:delete).
23
- with('heirloom', 'heirloom_old_archive').
24
- and_return true
20
+ with(:config => @config_double).
21
+ and_return @sdb_double
22
+ @sdb_double.should_receive(:delete).
23
+ with('heirloom', 'heirloom_old_archive').
24
+ and_return true
25
25
  @delete.delete_from_catalog.should be_true
26
26
  end
27
27
 
28
28
  it "should return false if an entry does not exist in catalog" do
29
- @verify_stub.stub :catalog_domain_exists? => false
29
+ @verify_double.stub :catalog_domain_exists? => false
30
30
  @delete.delete_from_catalog.should be_false
31
31
  end
32
32
 
@@ -3,18 +3,18 @@ require 'spec_helper'
3
3
  describe Heirloom::Catalog::List do
4
4
 
5
5
  before do
6
- @config_stub = stub 'config'
7
- @sdb_mock = mock 'sdb'
6
+ @config_double = double 'config'
7
+ @sdb_double = double 'sdb'
8
8
  Heirloom::AWS::SimpleDB.should_receive(:new).
9
- with(:config => @config_stub).
10
- and_return @sdb_mock
11
- @list = Heirloom::Catalog::List.new :config => @config_stub
9
+ with(:config => @config_double).
10
+ and_return @sdb_double
11
+ @list = Heirloom::Catalog::List.new :config => @config_double
12
12
  end
13
13
 
14
14
  it "should list all heirlooms in the catalog" do
15
- @sdb_mock.should_receive(:select).
16
- with("SELECT * FROM heirloom").
17
- and_return 'result'
15
+ @sdb_double.should_receive(:select).
16
+ with("SELECT * FROM heirloom").
17
+ and_return 'result'
18
18
  @list.all.should == 'result'
19
19
  end
20
20
 
@@ -3,24 +3,24 @@ require 'spec_helper'
3
3
  describe Heirloom::Catalog::Setup do
4
4
 
5
5
  before do
6
- @logger_stub = stub 'logger', :info => true
7
- @config_stub = stub 'config', :logger => @logger_stub,
6
+ @logger_double = double 'logger', :info => true
7
+ @config_double = double 'config', :logger => @logger_double,
8
8
  :metadata_region => 'us-west-1'
9
- @verify_stub = stub 'verify', :catalog_domain_exists? => false
9
+ @verify_double = double 'verify', :catalog_domain_exists? => false
10
10
  Heirloom::Catalog::Verify.should_receive(:new).
11
- with(:config => @config_stub).
12
- and_return @verify_stub
13
- @setup = Heirloom::Catalog::Setup.new :config => @config_stub,
11
+ with(:config => @config_double).
12
+ and_return @verify_double
13
+ @setup = Heirloom::Catalog::Setup.new :config => @config_double,
14
14
  :name => 'new_archive'
15
15
  end
16
16
 
17
17
  it "should call sdb to create the catalog domain" do
18
- @sdb_mock = mock 'sdb'
18
+ @sdb_double = double 'sdb'
19
19
  Heirloom::AWS::SimpleDB.should_receive(:new).
20
- with(:config => @config_stub).
21
- and_return @sdb_mock
22
- @sdb_mock.should_receive(:create_domain).
23
- with 'heirloom'
20
+ with(:config => @config_double).
21
+ and_return @sdb_double
22
+ @sdb_double.should_receive(:create_domain).
23
+ with 'heirloom'
24
24
  @setup.create_catalog_domain
25
25
  end
26
26
 
@@ -3,31 +3,31 @@ require 'spec_helper'
3
3
  describe Heirloom::Catalog::Show do
4
4
 
5
5
  before do
6
- @config_stub = stub 'config'
7
- @sdb_mock = mock 'sdb'
6
+ @config_double = double 'config'
7
+ @sdb_double = double 'sdb'
8
8
  Heirloom::AWS::SimpleDB.should_receive(:new).
9
- with(:config => @config_stub).
10
- and_return @sdb_mock
11
- @show = Heirloom::Catalog::Show.new :config => @config_stub,
9
+ with(:config => @config_double).
10
+ and_return @sdb_double
11
+ @show = Heirloom::Catalog::Show.new :config => @config_double,
12
12
  :name => 'a_archive'
13
13
  end
14
14
 
15
15
  it "should return the bucket_prefix" do
16
- result = { 'heirloom_a_archive' =>
17
- { 'bucket_prefix' => [ 'bp' ] }
16
+ result = { 'heirloom_a_archive' =>
17
+ { 'bucket_prefix' => [ 'bp' ] }
18
18
  }
19
- @sdb_mock.should_receive(:select).
20
- with("select bucket_prefix from heirloom where itemName() = 'heirloom_a_archive'").
21
- and_return result
19
+ @sdb_double.should_receive(:select).
20
+ with("select bucket_prefix from heirloom where itemName() = 'heirloom_a_archive'").
21
+ and_return result
22
22
  @show.bucket_prefix.should == 'bp'
23
23
  end
24
24
 
25
25
  it "should return the regions" do
26
26
  regions = ['us-west-1', 'us-west-2']
27
27
  result = { 'heirloom_a_archive' => { 'regions' => @regions } }
28
- @sdb_mock.should_receive(:select).
29
- with("select regions from heirloom where itemName() = 'heirloom_a_archive'").
30
- and_return result
28
+ @sdb_double.should_receive(:select).
29
+ with("select regions from heirloom where itemName() = 'heirloom_a_archive'").
30
+ and_return result
31
31
  @show.regions.should == @regions
32
32
  end
33
33
 
@@ -3,43 +3,43 @@ require 'spec_helper'
3
3
  describe Heirloom::Catalog::Verify do
4
4
 
5
5
  before do
6
- @sdb_mock = mock 'sdb'
7
- @logger_stub = stub 'logger', :info => true,
8
- :debug => true
9
- @config_stub = stub 'config', :logger => @logger_stub,
10
- :metadata_region => 'us-west-1'
6
+ @sdb_double = double 'sdb'
7
+ @logger_double = double 'logger', :info => true,
8
+ :debug => true
9
+ @config_double = double 'config', :logger => @logger_double,
10
+ :metadata_region => 'us-west-1'
11
11
  Heirloom::AWS::SimpleDB.should_receive(:new).
12
- with(:config => @config_stub).
13
- and_return @sdb_mock
14
- @verify = Heirloom::Catalog::Verify.new :config => @config_stub,
12
+ with(:config => @config_double).
13
+ and_return @sdb_double
14
+ @verify = Heirloom::Catalog::Verify.new :config => @config_double,
15
15
  :name => 'a_archive'
16
16
 
17
17
  end
18
18
 
19
19
  context "testing catalog_domain_exists" do
20
20
  it "should return true if heirloom domain exists" do
21
- @sdb_mock.should_receive(:domain_exists?).
22
- with('heirloom').and_return true
21
+ @sdb_double.should_receive(:domain_exists?).
22
+ with('heirloom').and_return true
23
23
  @verify.catalog_domain_exists?.should be_true
24
24
  end
25
25
 
26
26
  it "should return false if heirloom domain does not exists" do
27
- @sdb_mock.should_receive(:domain_exists?).
28
- with('heirloom').and_return false
27
+ @sdb_double.should_receive(:domain_exists?).
28
+ with('heirloom').and_return false
29
29
  @verify.catalog_domain_exists?.should be_false
30
30
  end
31
31
  end
32
32
 
33
33
  context "testing entry_exists_in_catalog?" do
34
34
  it "should return true if an entry exists in catalog" do
35
- @sdb_mock.should_receive(:item_count).
36
- with('heirloom', 'heirloom_a_archive').and_return 1
35
+ @sdb_double.should_receive(:item_count).
36
+ with('heirloom', 'heirloom_a_archive').and_return 1
37
37
  @verify.entry_exists_in_catalog?('a_archive').should be_true
38
38
  end
39
39
 
40
40
  it "should return false if an entry does not exist in catalog" do
41
- @sdb_mock.should_receive(:item_count).
42
- with('heirloom', 'heirloom_a_archive').and_return 0
41
+ @sdb_double.should_receive(:item_count).
42
+ with('heirloom', 'heirloom_a_archive').and_return 0
43
43
  @verify.entry_exists_in_catalog?('a_archive').should be_false
44
44
  end
45
45
  end
@@ -2,18 +2,18 @@ require 'spec_helper'
2
2
 
3
3
  describe Heirloom::Catalog do
4
4
 
5
- before do
6
- @config_mock = mock 'catalog'
5
+ before do
6
+ @config_double = double 'catalog'
7
7
  @regions = ['us-west-1', 'us-west-2']
8
8
  @bucket_prefix = 'bp'
9
- @catalog = Heirloom::Catalog.new :config => @config_mock, :name => 'new_archive'
9
+ @catalog = Heirloom::Catalog.new :config => @config_double, :name => 'new_archive'
10
10
 
11
- Heirloom.stub :log => mock_log
11
+ Heirloom.stub :log => double_log
12
12
  end
13
13
 
14
14
  context "cleanup" do
15
15
  before do
16
- @sdb = mock 'sdb'
16
+ @sdb = double 'sdb'
17
17
  @sdb.stub(:select)
18
18
  .and_yield('123', { 'preserve' => ['true'] })
19
19
  .and_yield('abc', { 'preserve' => ['true'] })
@@ -22,7 +22,7 @@ describe Heirloom::Catalog do
22
22
 
23
23
  it "should not destroy archives marked with 'preserve'" do
24
24
 
25
- archive = mock 'archive', :destroy => true
25
+ archive = double 'archive', :destroy => true
26
26
  @catalog.stub :sdb => @sdb
27
27
 
28
28
  Heirloom::Archive.should_receive(:new)
@@ -33,7 +33,7 @@ describe Heirloom::Catalog do
33
33
  end
34
34
 
35
35
  it "should destroy archives when removed_preserved is true" do
36
- archive = mock 'archive', :destroy => true
36
+ archive = double 'archive', :destroy => true
37
37
  @catalog.stub :sdb => @sdb
38
38
 
39
39
  Heirloom::Archive.should_receive(:new)
@@ -50,31 +50,31 @@ describe Heirloom::Catalog do
50
50
 
51
51
  @catalog.cleanup :num_to_keep => 10, :remove_preserved => true
52
52
  end
53
-
53
+
54
54
  end
55
55
 
56
56
  context "testing add" do
57
57
  it "should call setup to create catalog_domain" do
58
- @catalog_setup_stub = stub 'setup'
59
- @catalog_setup_stub.stub :create_catalog_domain => true
58
+ @catalog_setup_double = double 'setup'
59
+ @catalog_setup_double.stub :create_catalog_domain => true
60
60
  Heirloom::Catalog::Setup.should_receive(:new).
61
- with(:config => @config_mock).
62
- and_return @catalog_setup_stub
61
+ with(:config => @config_double).
62
+ and_return @catalog_setup_double
63
63
  @catalog.create_catalog_domain.should be_true
64
64
  end
65
65
  end
66
66
 
67
67
  context "testing setup" do
68
68
  it "should call setup to add_to_catalog" do
69
- @catalog_add_mock = mock 'add'
69
+ @catalog_add_double = double 'add'
70
70
  Heirloom::Catalog::Add.should_receive(:new).
71
- with(:config => @config_mock,
71
+ with(:config => @config_double,
72
72
  :name => 'new_archive').
73
- and_return @catalog_add_mock
74
- @catalog_add_mock.should_receive(:add_to_catalog).
75
- with(:bucket_prefix => @bucket_prefix,
76
- :regions => @regions).
77
- and_return true
73
+ and_return @catalog_add_double
74
+ @catalog_add_double.should_receive(:add_to_catalog).
75
+ with(:bucket_prefix => @bucket_prefix,
76
+ :regions => @regions).
77
+ and_return true
78
78
  @catalog.add_to_catalog(:bucket_prefix => @bucket_prefix,
79
79
  :regions => @regions).
80
80
  should be_true
@@ -83,12 +83,12 @@ describe Heirloom::Catalog do
83
83
 
84
84
  context "testing show" do
85
85
  before do
86
- @catalog_show_stub = stub 'show', :regions => @regions,
86
+ @catalog_show_double = double 'show', :regions => @regions,
87
87
  :bucket_prefix => @bucket_prefix
88
88
  Heirloom::Catalog::Show.should_receive(:new).
89
- with(:config => @config_mock,
89
+ with(:config => @config_double,
90
90
  :name => 'new_archive').
91
- and_return @catalog_show_stub
91
+ and_return @catalog_show_double
92
92
  end
93
93
 
94
94
  it "should call regions from show object" do
@@ -102,40 +102,40 @@ describe Heirloom::Catalog do
102
102
 
103
103
  context "testing catalog_domain_exists?" do
104
104
  before do
105
- @catalog_verify_stub = stub 'show'
105
+ @catalog_verify_double = double 'show'
106
106
  Heirloom::Catalog::Verify.should_receive(:new).
107
- with(:config => @config_mock).
108
- and_return @catalog_verify_stub
107
+ with(:config => @config_double).
108
+ and_return @catalog_verify_double
109
109
  end
110
110
  it "should return true if the catalog domain exists" do
111
- @catalog_verify_stub.stub :catalog_domain_exists? => true
111
+ @catalog_verify_double.stub :catalog_domain_exists? => true
112
112
  @catalog.catalog_domain_exists?.should be_true
113
113
  end
114
114
 
115
115
  it "should return false if the catalog domain does not exist" do
116
- @catalog_verify_stub.stub :catalog_domain_exists? => false
116
+ @catalog_verify_double.stub :catalog_domain_exists? => false
117
117
  @catalog.catalog_domain_exists?.should be_false
118
118
  end
119
119
  end
120
120
 
121
121
  context "testing entry_exists_in_catalog?" do
122
122
  before do
123
- @catalog_verify_mock = mock 'show'
123
+ @catalog_verify_double = double 'show'
124
124
  Heirloom::Catalog::Verify.should_receive(:new).
125
- with(:config => @config_mock).
126
- and_return @catalog_verify_mock
125
+ with(:config => @config_double).
126
+ and_return @catalog_verify_double
127
127
  end
128
128
  it "should return true if the entry exists in the catalog" do
129
- @catalog_verify_mock.should_receive(:entry_exists_in_catalog?).
130
- with('entry').
131
- and_return true
129
+ @catalog_verify_double.should_receive(:entry_exists_in_catalog?).
130
+ with('entry').
131
+ and_return true
132
132
  @catalog.entry_exists_in_catalog?('entry').should be_true
133
133
  end
134
134
 
135
135
  it "should return false if the entry does not exists in the catalog" do
136
- @catalog_verify_mock.should_receive(:entry_exists_in_catalog?).
137
- with('entry').
138
- and_return false
136
+ @catalog_verify_double.should_receive(:entry_exists_in_catalog?).
137
+ with('entry').
138
+ and_return false
139
139
  @catalog.entry_exists_in_catalog?('entry').should be_false
140
140
  end
141
141
  end
@@ -2,17 +2,17 @@ require 'spec_helper'
2
2
 
3
3
  describe Heirloom do
4
4
  before do
5
- @encrypted_file_mock = mock 'encrypted mock'
6
- @decrypted_file_mock = mock 'decrypted mock'
7
- @encrypted_file_mock.stub :path => '/tmp/enc'
8
- @decrypted_file_mock.stub :path => '/tmp/dec',
9
- :read => 'plaintext'
10
- @logger_mock = mock 'logger', :info => true
11
- @logger_mock.stub :info => true,
12
- :debug => true
13
- @config_mock = mock 'config'
14
- @config_mock.stub :logger => @logger_mock
15
- @data = Heirloom::Cipher::Data.new :config => @config_mock
5
+ @encrypted_file_double = double 'encrypted mock'
6
+ @decrypted_file_double = double 'decrypted mock'
7
+ @encrypted_file_double.stub :path => '/tmp/enc'
8
+ @decrypted_file_double.stub :path => '/tmp/dec',
9
+ :read => 'plaintext'
10
+ @logger_double = double 'logger', :info => true
11
+ @logger_double.stub :info => true,
12
+ :debug => true
13
+ @config_double = double 'config'
14
+ @config_double.stub :logger => @logger_double
15
+ @data = Heirloom::Cipher::Data.new :config => @config_double
16
16
  end
17
17
 
18
18
  context "when succesful" do
@@ -20,11 +20,11 @@ describe Heirloom do
20
20
  it "should decrypt the given data" do
21
21
  @data.should_receive(:which).with('gpg').and_return true
22
22
  Tempfile.should_receive(:new).with('archive.tar.gz.gpg').
23
- and_return @encrypted_file_mock
23
+ and_return @encrypted_file_double
24
24
  Tempfile.should_receive(:new).with('archive.tar.gz').
25
- and_return @decrypted_file_mock
25
+ and_return @decrypted_file_double
26
26
  ::File.should_receive(:open).
27
- with(@encrypted_file_mock,'w')
27
+ with(@encrypted_file_double,'w')
28
28
  $?.stub :success? => true
29
29
 
30
30
  command = 'gpg --batch --yes --cipher-algo AES256 --passphrase password --output /tmp/dec /tmp/enc 2>&1'
@@ -45,21 +45,21 @@ describe Heirloom do
45
45
  context "when unsuccesful" do
46
46
  context "with secret given" do
47
47
  it "should return false if gpg not in path" do
48
- @logger_mock.should_receive(:error)
48
+ @logger_double.should_receive(:error)
49
49
  @data.should_receive(:which).with('gpg').and_return false
50
50
  @data.decrypt_data(:data => 'crypted',
51
51
  :secret => 'password').should be_false
52
52
  end
53
53
 
54
54
  it "should return false if decrypted fails" do
55
- @logger_mock.should_receive(:error)
55
+ @logger_double.should_receive(:error)
56
56
  @data.should_receive(:which).with('gpg').and_return true
57
57
  Tempfile.should_receive(:new).with('archive.tar.gz.gpg').
58
- and_return @encrypted_file_mock
58
+ and_return @encrypted_file_double
59
59
  Tempfile.should_receive(:new).with('archive.tar.gz').
60
- and_return @decrypted_file_mock
60
+ and_return @decrypted_file_double
61
61
  ::File.should_receive(:open).
62
- with(@encrypted_file_mock,'w')
62
+ with(@encrypted_file_double,'w')
63
63
  $?.stub :success? => false
64
64
 
65
65
  command = 'gpg --batch --yes --cipher-algo AES256 --passphrase password --output /tmp/dec /tmp/enc 2>&1'