Permalink
Browse files

Wrote specs for the Backup::Configuration::Syncer::S3.

  • Loading branch information...
1 parent 0756e9d commit c9f9b6da7513b744e71d939ad703640f2ab987d3 Michael van Rooijen committed Mar 20, 2011
Showing with 43 additions and 0 deletions.
  1. +43 −0 spec/configuration/syncer/s3_spec.rb
@@ -0,0 +1,43 @@
+# encoding: utf-8
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Backup::Configuration::Syncer::S3 do
+ before do
+ Backup::Configuration::Syncer::S3.defaults do |s3|
+ s3.access_key_id = 'my_access_key_id'
+ s3.secret_access_key = 'my_secret_access_key'
+ s3.bucket = 'my-bucket'
+ s3.path = '/backups/'
+ s3.directories = '/directories/to/backup/'
+ s3.mirror = true
+ s3.additional_options = ['--exclude="*.rb"']
+ end
+ end
+
+ it 'should set the default s3 configuration' do
+ s3 = Backup::Configuration::Syncer::S3
+ s3.access_key_id.should == 'my_access_key_id'
+ s3.secret_access_key.should == 'my_secret_access_key'
+ s3.bucket.should == 'my-bucket'
+ s3.path.should == '/backups/'
+ s3.directories.should == '/directories/to/backup/'
+ s3.mirror.should == true
+ s3.additional_options.should == ['--exclude="*.rb"']
+ end
+
+ describe '#clear_defaults!' do
+ it 'should clear all the defaults, resetting them to nil' do
+ Backup::Configuration::Syncer::S3.clear_defaults!
+
+ s3 = Backup::Configuration::Syncer::S3
+ s3.access_key_id.should == nil
+ s3.secret_access_key.should == nil
+ s3.bucket.should == nil
+ s3.path.should == nil
+ s3.directories.should == nil
+ s3.mirror.should == nil
+ s3.additional_options.should == nil
+ end
+ end
+end

0 comments on commit c9f9b6d

Please sign in to comment.