interu-backup 3.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +31 -0
  3. data/Gemfile.lock +117 -0
  4. data/Guardfile +17 -0
  5. data/LICENSE.md +24 -0
  6. data/README.md +332 -0
  7. data/backup.gemspec +31 -0
  8. data/bin/backup +267 -0
  9. data/lib/backup.rb +181 -0
  10. data/lib/backup/archive.rb +73 -0
  11. data/lib/backup/cli.rb +82 -0
  12. data/lib/backup/compressor/base.rb +17 -0
  13. data/lib/backup/compressor/bzip2.rb +64 -0
  14. data/lib/backup/compressor/gzip.rb +61 -0
  15. data/lib/backup/configuration/base.rb +15 -0
  16. data/lib/backup/configuration/compressor/base.rb +10 -0
  17. data/lib/backup/configuration/compressor/bzip2.rb +23 -0
  18. data/lib/backup/configuration/compressor/gzip.rb +23 -0
  19. data/lib/backup/configuration/database/base.rb +18 -0
  20. data/lib/backup/configuration/database/mongodb.rb +41 -0
  21. data/lib/backup/configuration/database/mysql.rb +37 -0
  22. data/lib/backup/configuration/database/postgresql.rb +37 -0
  23. data/lib/backup/configuration/database/redis.rb +35 -0
  24. data/lib/backup/configuration/encryptor/base.rb +10 -0
  25. data/lib/backup/configuration/encryptor/gpg.rb +17 -0
  26. data/lib/backup/configuration/encryptor/open_ssl.rb +26 -0
  27. data/lib/backup/configuration/helpers.rb +54 -0
  28. data/lib/backup/configuration/notifier/base.rb +39 -0
  29. data/lib/backup/configuration/notifier/campfire.rb +25 -0
  30. data/lib/backup/configuration/notifier/mail.rb +52 -0
  31. data/lib/backup/configuration/notifier/presently.rb +25 -0
  32. data/lib/backup/configuration/notifier/twitter.rb +21 -0
  33. data/lib/backup/configuration/storage/base.rb +18 -0
  34. data/lib/backup/configuration/storage/cloudfiles.rb +21 -0
  35. data/lib/backup/configuration/storage/dropbox.rb +29 -0
  36. data/lib/backup/configuration/storage/ftp.rb +25 -0
  37. data/lib/backup/configuration/storage/rsync.rb +25 -0
  38. data/lib/backup/configuration/storage/s3.rb +25 -0
  39. data/lib/backup/configuration/storage/scp.rb +25 -0
  40. data/lib/backup/configuration/storage/sftp.rb +25 -0
  41. data/lib/backup/configuration/syncer/rsync.rb +45 -0
  42. data/lib/backup/configuration/syncer/s3.rb +33 -0
  43. data/lib/backup/database/base.rb +33 -0
  44. data/lib/backup/database/mongodb.rb +179 -0
  45. data/lib/backup/database/mysql.rb +104 -0
  46. data/lib/backup/database/postgresql.rb +111 -0
  47. data/lib/backup/database/redis.rb +105 -0
  48. data/lib/backup/dependency.rb +96 -0
  49. data/lib/backup/encryptor/base.rb +17 -0
  50. data/lib/backup/encryptor/gpg.rb +78 -0
  51. data/lib/backup/encryptor/open_ssl.rb +67 -0
  52. data/lib/backup/exception/command_not_found.rb +8 -0
  53. data/lib/backup/finder.rb +39 -0
  54. data/lib/backup/logger.rb +102 -0
  55. data/lib/backup/model.rb +272 -0
  56. data/lib/backup/notifier/base.rb +29 -0
  57. data/lib/backup/notifier/binder.rb +32 -0
  58. data/lib/backup/notifier/campfire.rb +194 -0
  59. data/lib/backup/notifier/mail.rb +141 -0
  60. data/lib/backup/notifier/presently.rb +105 -0
  61. data/lib/backup/notifier/templates/notify_failure.erb +33 -0
  62. data/lib/backup/notifier/templates/notify_success.erb +16 -0
  63. data/lib/backup/notifier/twitter.rb +87 -0
  64. data/lib/backup/storage/base.rb +67 -0
  65. data/lib/backup/storage/cloudfiles.rb +95 -0
  66. data/lib/backup/storage/dropbox.rb +91 -0
  67. data/lib/backup/storage/ftp.rb +114 -0
  68. data/lib/backup/storage/object.rb +45 -0
  69. data/lib/backup/storage/rsync.rb +129 -0
  70. data/lib/backup/storage/s3.rb +180 -0
  71. data/lib/backup/storage/scp.rb +106 -0
  72. data/lib/backup/storage/sftp.rb +106 -0
  73. data/lib/backup/syncer/base.rb +10 -0
  74. data/lib/backup/syncer/rsync.rb +152 -0
  75. data/lib/backup/syncer/s3.rb +118 -0
  76. data/lib/backup/version.rb +43 -0
  77. data/lib/templates/archive +7 -0
  78. data/lib/templates/compressor/bzip2 +7 -0
  79. data/lib/templates/compressor/gzip +7 -0
  80. data/lib/templates/database/mongodb +14 -0
  81. data/lib/templates/database/mysql +14 -0
  82. data/lib/templates/database/postgresql +14 -0
  83. data/lib/templates/database/redis +13 -0
  84. data/lib/templates/encryptor/gpg +12 -0
  85. data/lib/templates/encryptor/openssl +8 -0
  86. data/lib/templates/notifier/campfire +11 -0
  87. data/lib/templates/notifier/mail +17 -0
  88. data/lib/templates/notifier/presently +12 -0
  89. data/lib/templates/notifier/twitter +12 -0
  90. data/lib/templates/readme +15 -0
  91. data/lib/templates/storage/cloudfiles +10 -0
  92. data/lib/templates/storage/dropbox +12 -0
  93. data/lib/templates/storage/ftp +11 -0
  94. data/lib/templates/storage/rsync +10 -0
  95. data/lib/templates/storage/s3 +21 -0
  96. data/lib/templates/storage/scp +11 -0
  97. data/lib/templates/storage/sftp +11 -0
  98. data/lib/templates/syncer/rsync +17 -0
  99. data/lib/templates/syncer/s3 +15 -0
  100. data/spec/archive_spec.rb +90 -0
  101. data/spec/backup_spec.rb +11 -0
  102. data/spec/compressor/bzip2_spec.rb +59 -0
  103. data/spec/compressor/gzip_spec.rb +59 -0
  104. data/spec/configuration/base_spec.rb +35 -0
  105. data/spec/configuration/compressor/gzip_spec.rb +28 -0
  106. data/spec/configuration/database/base_spec.rb +16 -0
  107. data/spec/configuration/database/mongodb_spec.rb +30 -0
  108. data/spec/configuration/database/mysql_spec.rb +32 -0
  109. data/spec/configuration/database/postgresql_spec.rb +32 -0
  110. data/spec/configuration/database/redis_spec.rb +30 -0
  111. data/spec/configuration/encryptor/gpg_spec.rb +25 -0
  112. data/spec/configuration/encryptor/open_ssl_spec.rb +31 -0
  113. data/spec/configuration/notifier/campfire_spec.rb +20 -0
  114. data/spec/configuration/notifier/mail_spec.rb +32 -0
  115. data/spec/configuration/notifier/twitter_spec.rb +22 -0
  116. data/spec/configuration/storage/cloudfiles_spec.rb +34 -0
  117. data/spec/configuration/storage/dropbox_spec.rb +43 -0
  118. data/spec/configuration/storage/ftp_spec.rb +40 -0
  119. data/spec/configuration/storage/rsync_spec.rb +37 -0
  120. data/spec/configuration/storage/s3_spec.rb +37 -0
  121. data/spec/configuration/storage/scp_spec.rb +40 -0
  122. data/spec/configuration/storage/sftp_spec.rb +40 -0
  123. data/spec/configuration/syncer/rsync_spec.rb +46 -0
  124. data/spec/configuration/syncer/s3_spec.rb +43 -0
  125. data/spec/database/base_spec.rb +30 -0
  126. data/spec/database/mongodb_spec.rb +181 -0
  127. data/spec/database/mysql_spec.rb +150 -0
  128. data/spec/database/postgresql_spec.rb +164 -0
  129. data/spec/database/redis_spec.rb +122 -0
  130. data/spec/encryptor/gpg_spec.rb +57 -0
  131. data/spec/encryptor/open_ssl_spec.rb +102 -0
  132. data/spec/logger_spec.rb +58 -0
  133. data/spec/model_spec.rb +236 -0
  134. data/spec/notifier/campfire_spec.rb +96 -0
  135. data/spec/notifier/mail_spec.rb +97 -0
  136. data/spec/notifier/presently_spec.rb +99 -0
  137. data/spec/notifier/twitter_spec.rb +86 -0
  138. data/spec/spec_helper.rb +25 -0
  139. data/spec/storage/base_spec.rb +33 -0
  140. data/spec/storage/cloudfiles_spec.rb +102 -0
  141. data/spec/storage/dropbox_spec.rb +105 -0
  142. data/spec/storage/ftp_spec.rb +133 -0
  143. data/spec/storage/object_spec.rb +74 -0
  144. data/spec/storage/rsync_spec.rb +131 -0
  145. data/spec/storage/s3_spec.rb +110 -0
  146. data/spec/storage/scp_spec.rb +129 -0
  147. data/spec/storage/sftp_spec.rb +125 -0
  148. data/spec/syncer/rsync_spec.rb +195 -0
  149. data/spec/syncer/s3_spec.rb +139 -0
  150. data/spec/version_spec.rb +21 -0
  151. metadata +231 -0
@@ -0,0 +1,59 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../spec_helper'
4
+
5
+ describe Backup::Compressor::Gzip do
6
+ let(:compressor) { Backup::Compressor::Gzip.new }
7
+
8
+ before do
9
+ Backup::Model.extension = 'tar'
10
+ end
11
+
12
+ describe 'the options' do
13
+ it do
14
+ compressor.send(:best).should == []
15
+ end
16
+
17
+ it do
18
+ compressor.send(:fast).should == []
19
+ end
20
+ end
21
+
22
+ describe '#perform!' do
23
+ before do
24
+ [:run, :utility].each { |method| compressor.stubs(method) }
25
+ Backup::Logger.stubs(:message)
26
+ end
27
+
28
+ it 'should perform the compression' do
29
+ compressor.expects(:utility).with(:gzip).returns(:gzip)
30
+ compressor.expects(:run).with("gzip '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }'")
31
+ compressor.perform!
32
+ end
33
+
34
+ it 'should perform the compression with the --best and --fast options' do
35
+ compressor = Backup::Compressor::Gzip.new do |c|
36
+ c.best = true
37
+ c.fast = true
38
+ end
39
+
40
+ compressor.stubs(:utility).returns(:gzip)
41
+ compressor.expects(:run).with("gzip --best --fast '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }'")
42
+ compressor.perform!
43
+ end
44
+
45
+ it 'should set the class variable @extension (Backup::Model.extension) to .gz' do
46
+ compressor.stubs(:utility).returns(:gzip)
47
+ compressor.expects(:run)
48
+
49
+ Backup::Model.extension.should == 'tar'
50
+ compressor.perform!
51
+ Backup::Model.extension.should == 'tar.gz'
52
+ end
53
+
54
+ it 'should log' do
55
+ Backup::Logger.expects(:message).with("Backup::Compressor::Gzip started compressing the archive.")
56
+ compressor.perform!
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../spec_helper'
4
+
5
+ describe Backup::Configuration::Helpers do
6
+
7
+ before do
8
+ class Backup::Configuration::Base
9
+ class << self
10
+ attr_accessor :rspec_method, :rspec_test, :rspec_mocha
11
+ end
12
+ end
13
+ end
14
+
15
+ it 'should clear the defaults' do
16
+ Backup::Configuration::Base.expects(:send).with('rspec_method=', nil)
17
+ Backup::Configuration::Base.expects(:send).with('rspec_test=', nil)
18
+ Backup::Configuration::Base.expects(:send).with('rspec_mocha=', nil)
19
+ Backup::Configuration::Base.clear_defaults!
20
+ end
21
+
22
+ it 'should return the setters' do
23
+ Backup::Configuration::Base.setter_methods.count.should == 3
24
+ %w[rspec_method= rspec_test= rspec_mocha=].each do |method|
25
+ Backup::Configuration::Base.setter_methods.should include(method)
26
+ end
27
+ end
28
+
29
+ it 'should return the getters' do
30
+ Backup::Configuration::Base.getter_methods.count.should == 3
31
+ %w[rspec_method rspec_test rspec_mocha].each do |method|
32
+ Backup::Configuration::Base.getter_methods.should include(method)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Compressor::Gzip do
6
+ before do
7
+ Backup::Configuration::Compressor::Gzip.defaults do |compressor|
8
+ compressor.best = true
9
+ compressor.fast = true
10
+ end
11
+ end
12
+
13
+ it 'should set the default compressor configuration' do
14
+ compressor = Backup::Configuration::Compressor::Gzip
15
+ compressor.best.should == true
16
+ compressor.fast.should == true
17
+ end
18
+
19
+ describe '#clear_defaults!' do
20
+ it 'should clear all the defaults, resetting them to nil' do
21
+ Backup::Configuration::Compressor::Gzip.clear_defaults!
22
+
23
+ compressor = Backup::Configuration::Compressor::Gzip
24
+ compressor.best.should == nil
25
+ compressor.fast.should == nil
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Database::Base do
6
+ before do
7
+ Backup::Configuration::Database::Base.defaults do |db|
8
+ db.utility_path = '/usr/bin/my_util'
9
+ end
10
+ end
11
+
12
+ it 'should set the default Base configuration' do
13
+ db = Backup::Configuration::Database::Base
14
+ db.utility_path.should == '/usr/bin/my_util'
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Database::MongoDB do
6
+ before do
7
+ Backup::Configuration::Database::MongoDB.defaults do |db|
8
+ db.name = 'mydb'
9
+ db.username = 'myuser'
10
+ db.password = 'mypassword'
11
+ db.host = 'myhost'
12
+ db.port = 'myport'
13
+ db.only_collections = %w[my other tables]
14
+ db.additional_options = %w[my options]
15
+ db.ipv6 = true
16
+ end
17
+ end
18
+
19
+ it 'should set the default MongoDB configuration' do
20
+ db = Backup::Configuration::Database::MongoDB
21
+ db.name.should == 'mydb'
22
+ db.username.should == 'myuser'
23
+ db.password.should == 'mypassword'
24
+ db.host.should == 'myhost'
25
+ db.port.should == 'myport'
26
+ db.only_collections.should == %w[my other tables]
27
+ db.additional_options.should == %w[my options]
28
+ db.ipv6.should == true
29
+ end
30
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Database::MySQL do
6
+ before do
7
+ Backup::Configuration::Database::MySQL.defaults do |db|
8
+ db.name = 'mydb'
9
+ db.username = 'myuser'
10
+ db.password = 'mypassword'
11
+ db.host = 'myhost'
12
+ db.port = 'myport'
13
+ db.socket = 'mysocket'
14
+ db.skip_tables = %w[my tables]
15
+ db.only_tables = %w[my other tables]
16
+ db.additional_options = %w[my options]
17
+ end
18
+ end
19
+
20
+ it 'should set the default MySQL configuration' do
21
+ db = Backup::Configuration::Database::MySQL
22
+ db.name.should == 'mydb'
23
+ db.username.should == 'myuser'
24
+ db.password.should == 'mypassword'
25
+ db.host.should == 'myhost'
26
+ db.port.should == 'myport'
27
+ db.socket.should == 'mysocket'
28
+ db.skip_tables.should == %w[my tables]
29
+ db.only_tables.should == %w[my other tables]
30
+ db.additional_options.should == %w[my options]
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Database::PostgreSQL do
6
+ before do
7
+ Backup::Configuration::Database::PostgreSQL.defaults do |db|
8
+ db.name = 'mydb'
9
+ db.username = 'myuser'
10
+ db.password = 'mypassword'
11
+ db.host = 'myhost'
12
+ db.port = 'myport'
13
+ db.socket = 'mysocket'
14
+ db.skip_tables = %w[my tables]
15
+ db.only_tables = %w[my other tables]
16
+ db.additional_options = %w[my options]
17
+ end
18
+ end
19
+
20
+ it 'should set the default PostgreSQL configuration' do
21
+ db = Backup::Configuration::Database::PostgreSQL
22
+ db.name.should == 'mydb'
23
+ db.username.should == 'myuser'
24
+ db.password.should == 'mypassword'
25
+ db.host.should == 'myhost'
26
+ db.port.should == 'myport'
27
+ db.socket.should == 'mysocket'
28
+ db.skip_tables.should == %w[my tables]
29
+ db.only_tables.should == %w[my other tables]
30
+ db.additional_options.should == %w[my options]
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Database::Redis do
6
+ before do
7
+ Backup::Configuration::Database::Redis.defaults do |db|
8
+ db.name = 'mydb'
9
+ db.path = '/var/lib/redis/db'
10
+ db.password = 'mypassword'
11
+ db.invoke_save = true
12
+ db.host = 'localhost'
13
+ db.port = 123
14
+ db.socket = '/redis.sock'
15
+ db.additional_options = %w[my options]
16
+ end
17
+ end
18
+
19
+ it 'should set the default Redis configuration' do
20
+ db = Backup::Configuration::Database::Redis
21
+ db.name.should == 'mydb'
22
+ db.path.should == '/var/lib/redis/db'
23
+ db.password.should == 'mypassword'
24
+ db.invoke_save.should == true
25
+ db.host.should == 'localhost'
26
+ db.port.should == 123
27
+ db.socket.should == '/redis.sock'
28
+ db.additional_options.should == %w[my options]
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Encryptor::GPG do
6
+ before do
7
+ Backup::Configuration::Encryptor::GPG.defaults do |encryptor|
8
+ encryptor.key = 'my_key'
9
+ end
10
+ end
11
+
12
+ it 'should set the default encryptor configuration' do
13
+ encryptor = Backup::Configuration::Encryptor::GPG
14
+ encryptor.key.should == 'my_key'
15
+ end
16
+
17
+ describe '#clear_defaults!' do
18
+ it 'should clear all the defaults, resetting them to nil' do
19
+ Backup::Configuration::Encryptor::GPG.clear_defaults!
20
+
21
+ encryptor = Backup::Configuration::Encryptor::GPG
22
+ encryptor.key.should == nil
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Encryptor::OpenSSL do
6
+ before do
7
+ Backup::Configuration::Encryptor::OpenSSL.defaults do |encryptor|
8
+ encryptor.password = 'my_password'
9
+ encryptor.base64 = true
10
+ encryptor.salt = true
11
+ end
12
+ end
13
+
14
+ it 'should set the default encryptor configuration' do
15
+ encryptor = Backup::Configuration::Encryptor::OpenSSL
16
+ encryptor.password.should == 'my_password'
17
+ encryptor.base64.should == true
18
+ encryptor.salt.should == true
19
+ end
20
+
21
+ describe '#clear_defaults!' do
22
+ it 'should clear all the defaults, resetting them to nil' do
23
+ Backup::Configuration::Encryptor::OpenSSL.clear_defaults!
24
+
25
+ encryptor = Backup::Configuration::Encryptor::OpenSSL
26
+ encryptor.password.should == nil
27
+ encryptor.base64.should == nil
28
+ encryptor.salt.should == nil
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Notifier::Campfire do
6
+ before do
7
+ Backup::Configuration::Notifier::Campfire.defaults do |campfire|
8
+ campfire.api_token = 'my_api_authentication_token'
9
+ campfire.subdomain = 'my_subdomain'
10
+ campfire.room_id = 'my_room_id'
11
+ end
12
+ end
13
+
14
+ it 'should set the default campfire configuration' do
15
+ campfire = Backup::Configuration::Notifier::Campfire
16
+ campfire.api_token.should == 'my_api_authentication_token'
17
+ campfire.subdomain.should == 'my_subdomain'
18
+ campfire.room_id.should == 'my_room_id'
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Notifier::Mail do
6
+ before do
7
+ Backup::Configuration::Notifier::Mail.defaults do |mail|
8
+ mail.from = 'my.sender.email@gmail.com'
9
+ mail.to = 'my.receiver.email@gmail.com'
10
+ mail.address = 'smtp.gmail.com'
11
+ mail.port = 587
12
+ mail.domain = 'your.host.name'
13
+ mail.user_name = 'user'
14
+ mail.password = 'secret'
15
+ mail.authentication = 'plain'
16
+ mail.enable_starttls_auto = true
17
+ end
18
+ end
19
+
20
+ it 'should set the default Mail configuration' do
21
+ mail = Backup::Configuration::Notifier::Mail
22
+ mail.from.should == 'my.sender.email@gmail.com'
23
+ mail.to.should == 'my.receiver.email@gmail.com'
24
+ mail.address.should == 'smtp.gmail.com'
25
+ mail.port.should == 587
26
+ mail.domain.should == 'your.host.name'
27
+ mail.user_name.should == 'user'
28
+ mail.password.should == 'secret'
29
+ mail.authentication.should == 'plain'
30
+ mail.enable_starttls_auto.should == true
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Notifier::Twitter do
6
+ before do
7
+ Backup::Configuration::Notifier::Twitter.defaults do |tweet|
8
+ tweet.consumer_key = 'my_consumer_key'
9
+ tweet.consumer_secret = 'my_consumer_secret'
10
+ tweet.oauth_token = 'my_oauth_token'
11
+ tweet.oauth_token_secret = 'my_oauth_token_secret'
12
+ end
13
+ end
14
+
15
+ it 'should set the default tweet configuration' do
16
+ tweet = Backup::Configuration::Notifier::Twitter
17
+ tweet.consumer_key.should == 'my_consumer_key'
18
+ tweet.consumer_secret.should == 'my_consumer_secret'
19
+ tweet.oauth_token.should == 'my_oauth_token'
20
+ tweet.oauth_token_secret.should == 'my_oauth_token_secret'
21
+ end
22
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+
3
+ require File.dirname(__FILE__) + '/../../spec_helper'
4
+
5
+ describe Backup::Configuration::Storage::CloudFiles do
6
+ before do
7
+ Backup::Configuration::Storage::CloudFiles.defaults do |cf|
8
+ cf.username = 'my_username'
9
+ cf.api_key = 'my_api_key'
10
+ cf.container = 'my_container'
11
+ cf.path = 'my_backups'
12
+ end
13
+ end
14
+
15
+ it 'should set the default Cloud Files configuration' do
16
+ cf = Backup::Configuration::Storage::CloudFiles
17
+ cf.username.should == 'my_username'
18
+ cf.api_key.should == 'my_api_key'
19
+ cf.container.should == 'my_container'
20
+ cf.path.should == 'my_backups'
21
+ end
22
+
23
+ describe '#clear_defaults!' do
24
+ it 'should clear all the defaults, resetting them to nil' do
25
+ Backup::Configuration::Storage::CloudFiles.clear_defaults!
26
+
27
+ cf = Backup::Configuration::Storage::CloudFiles
28
+ cf.username.should == nil
29
+ cf.api_key.should == nil
30
+ cf.container.should == nil
31
+ cf.path.should == nil
32
+ end
33
+ end
34
+ end