<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.autotest</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -28,7 +28,7 @@ end
 
 Micronaut::RakeTask.new(:rcov) do |examples|
   examples.pattern = 'examples/**/*_example.rb'
-  examples.rcov_opts = '-Ilib -Iexamples'
+  examples.rcov_opts = '-Ilib -Iexamples -iastrails -x\/gems\/'
   examples.rcov = true
 end
 </diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,9 @@ describe Astrails::Safe::Local do
     {
       :local =&gt; {
         :path =&gt; &quot;/:kind~:id~:timestamp&quot;
+      },
+      :keep =&gt; {
+        :local =&gt; 2
       }
     }
   end
@@ -77,6 +80,25 @@ describe Astrails::Safe::Local do
   end
 
   describe :cleanup do
-    it &quot;should have test&quot;
+    before(:each) do
+      @local = local
+      @files = [4,1,3,2].to_a.map { |i| &quot;aaaaa#{i}&quot; }
+      stub(Dir).[](anything) {@files}
+      stub(File).file?(anything) {true}
+      stub(File).size(anything) {1}
+      stub(File).unlink
+    end
+
+    it &quot;should check [:keep, :local]&quot; do
+      @local.config[:keep][:local] = nil
+      dont_allow(Dir).[]
+      @local.send :cleanup
+    end
+
+    it &quot;should delete extra files&quot; do
+      mock(File).unlink(&quot;aaaaa1&quot;)
+      mock(File).unlink(&quot;aaaaa2&quot;)
+      @local.send :cleanup
+    end
   end
 end</diff>
      <filename>examples/unit/local_example.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,6 @@ describe Astrails::Safe::S3 do
         :bucket =&gt; &quot;_bucket&quot;,
         :key    =&gt; &quot;_key&quot;,
         :secret =&gt; &quot;_secret&quot;,
-        :path   =&gt; &quot;s3_path&quot;
       },
       :keep =&gt; {
         :s3 =&gt; 2
@@ -40,12 +39,12 @@ describe Astrails::Safe::S3 do
 
       @files = [4,1,3,2].to_a.map { |i| stub(o = {}).key {&quot;aaaaa#{i}&quot;}; o }
 
-      stub(AWS::S3::Bucket).objects(&quot;_bucket&quot;, :prefix =&gt; &quot;s3_path/_kind-_id&quot;, :max_keys =&gt; 4) {@files}
+      stub(AWS::S3::Bucket).objects(&quot;_bucket&quot;, :prefix =&gt; &quot;_kind/_id/_kind-_id&quot;, :max_keys =&gt; 4) {@files}
       stub(AWS::S3::Bucket).find(&quot;_bucket&quot;).stub![anything].stub!.delete
     end
 
     it &quot;should check [:keep, :s3]&quot; do
-      mock(@s3.config).[](:keep, :s3) {nil}
+      @s3.config[:keep][:s3] = nil
       dont_allow(@s3.backup).filename
       @s3.send :cleanup
     end
@@ -56,21 +55,52 @@ describe Astrails::Safe::S3 do
       @s3.send :cleanup
     end
 
-    it &quot;should have more tests&quot;
-
   end
 
   describe :active do
-    it &quot;should be true when all params are set&quot;
-    it &quot;should be false if bucket is missing&quot;
-    it &quot;should be false if key is missing&quot;
-    it &quot;should be false if secret is missing&quot;
+    before(:each) do
+      @s3 = s3
+    end
+
+    it &quot;should be true when all params are set&quot; do
+      @s3.should be_active
+    end
+
+    it &quot;should be false if bucket is missing&quot; do
+      @s3.config[:s3][:bucket] = nil
+      @s3.should_not be_active
+    end
+
+    it &quot;should be false if key is missing&quot; do
+      @s3.config[:s3][:key] = nil
+      @s3.should_not be_active
+    end
+
+    it &quot;should be false if secret is missing&quot; do
+      @s3.config[:s3][:secret] = nil
+      @s3.should_not be_active
+    end
   end
 
   describe :prefix do
-    it &quot;should use s3/path 1st&quot;
-    it &quot;should use local/path 2nd&quot;
-    it &quot;should use constant 3rd&quot;
+    before(:each) do
+      @s3 = s3
+    end
+    it &quot;should use s3/path 1st&quot; do
+      @s3.config[:s3][:path] = &quot;s3_path&quot;
+      @s3.config[:local] = {:path =&gt; &quot;local_path&quot;}
+      @s3.send(:prefix).should == &quot;s3_path&quot;
+    end
+
+    it &quot;should use local/path 2nd&quot; do
+      @s3.config[:local] = {:path =&gt; &quot;local_path&quot;}
+      @s3.send(:prefix).should == &quot;local_path&quot;
+    end
+
+    it &quot;should use constant 3rd&quot; do
+      @s3.send(:prefix).should == &quot;_kind/_id&quot;
+    end
+
   end
 
   describe :save do</diff>
      <filename>examples/unit/s3_example.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ module Astrails
 
         base = File.basename(@backup.filename).split(&quot;.&quot;).first
 
-        puts &quot;listing files in #{bucket}:#{prefix}/#{base}&quot;
+        puts &quot;listing files in #{bucket}:#{prefix}/#{base}&quot; if $_VERBOSE
         files = AWS::S3::Bucket.objects(bucket, :prefix =&gt; &quot;#{prefix}/#{base}&quot;, :max_keys =&gt; keep * 2)
         puts files.collect {|x| x.key} if $_VERBOSE
 </diff>
      <filename>lib/astrails/safe/s3.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6b9e6b0a206bdeb5ad1c239ecb4e360a0657143a</id>
    </parent>
  </parents>
  <author>
    <name>Vitaly Kushner</name>
    <email>vitaly@astrails.com</email>
  </author>
  <url>http://github.com/astrails/safe/commit/419466a2b2dfd1153105fe47665f91249a24e7c7</url>
  <id>419466a2b2dfd1153105fe47665f91249a24e7c7</id>
  <committed-date>2009-05-22T09:17:51-07:00</committed-date>
  <authored-date>2009-05-22T09:17:51-07:00</authored-date>
  <message>more testing</message>
  <tree>f7c781836314fb700ec118e741712b7c79da27e0</tree>
  <committer>
    <name>Vitaly Kushner</name>
    <email>vitaly@astrails.com</email>
  </committer>
</commit>
