Sha256: ef19f810afeed8bf04d6616968e7f2776865c37cfc920a85b02dadcb601fdf1f
Contents?: true
Size: 1.63 KB
Versions: 22
Compression:
Stored size: 1.63 KB
Contents
# encoding: utf-8 require File.dirname(__FILE__) + '/../spec_helper' describe Backup::Compressor::Gzip do let(:compressor) { Backup::Compressor::Gzip.new } before do Backup::Model.extension = 'tar' end describe 'the options' do it do compressor.send(:best).should == [] end it do compressor.send(:fast).should == [] end end describe '#perform!' do before do [:run, :utility].each { |method| compressor.stubs(method) } Backup::Logger.stubs(:message) end it 'should perform the compression' do compressor.expects(:utility).with(:gzip).returns(:gzip) compressor.expects(:run).with("gzip '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }'") compressor.perform! end it 'should perform the compression with the --best and --fast options' do compressor = Backup::Compressor::Gzip.new do |c| c.best = true c.fast = true end compressor.stubs(:utility).returns(:gzip) compressor.expects(:run).with("gzip --best --fast '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }'") compressor.perform! end it 'should set the class variable @extension (Backup::Model.extension) to .gz' do compressor.stubs(:utility).returns(:gzip) compressor.expects(:run) Backup::Model.extension.should == 'tar' compressor.perform! Backup::Model.extension.should == 'tar.gz' end it 'should log' do Backup::Logger.expects(:message).with("Backup::Compressor::Gzip started compressing the archive.") compressor.perform! end end end
Version data entries
22 entries across 22 versions & 3 rubygems