Commits

Anonymous committed 318f988

! Now returns transformed snapshot name

  • Participants
  • Parent commits 63377cf

Comments (0)

Files changed (2)

lib/zfs/dataset.rb

   def snapshot(name, recursive=false)
     arguments = []
     
+    snapshot_name = self.name + "@" + sanitize_snapshot_name(name)
+    
     arguments << '-r' if recursive
-    arguments << self.name + "@" + sanitize_snapshot_name(name)
+    arguments << snapshot_name
     
     zfs_snapshot(*arguments)
+    
+    return snapshot_name
   end
   
   # Snapshots the dataset with a timestamp that looks like 201101011345 (year,
     name << "-#{comment}" if comment
     
     snapshot(name, true)
-    
-    name
   end
   
 private

spec/unit/zfs/dataset_spec.rb

     end 
     it "should return the name of the snapshot that was created" do
       flexmock(dataset).
-        should_receive(:snapshot)
+        should_receive(:zfs_snapshot)
         
       dataset.snapshot_with_timestamp('test').should match(/\d{12}-test/)
     end